diff --git a/browser/components/places/content/treeView.js b/browser/components/places/content/treeView.js index ca597dd44a0..f5ceb51db7f 100644 --- a/browser/components/places/content/treeView.js +++ b/browser/components/places/content/treeView.js @@ -198,7 +198,8 @@ PlacesTreeView.prototype = { * @return [parentNode, parentRow] */ _getParentByChildRow: function PTV__getParentByChildRow(aChildRow) { - let parent = this._getNodeForRow(aChildRow).parent; + let node = this._getNodeForRow(aChildRow); + let parent = (node === null) ? this._rootNode : node.parent; // The root node is never visible if (parent == this._rootNode) @@ -212,6 +213,10 @@ PlacesTreeView.prototype = { * Gets the node at a given row. */ _getNodeForRow: function PTV__getNodeForRow(aRow) { + if (aRow < 0) { + return null; + } + let node = this._rows[aRow]; if (node !== undefined) return node;