diff --git a/mozilla/browser/components/bookmarks/content/addBookmark2.js b/mozilla/browser/components/bookmarks/content/addBookmark2.js index d71b23dd57c..83e4b918508 100644 --- a/mozilla/browser/components/bookmarks/content/addBookmark2.js +++ b/mozilla/browser/components/bookmarks/content/addBookmark2.js @@ -303,6 +303,14 @@ function selectMenulistFolder(aEvent) function selectTreeFolder() { + // If no item is selected, we obviously can't do anything with the selection. + // This happens when the bookmarks tree rebuilds, since the rebuild starts + // by removing all items from the tree, including the currently selected item, + // and removing the selection also triggers the "select" handler which calls + // this function. + if (gBookmarksTree.currentIndex == -1) + return; + var resource = gBookmarksTree.currentResource; if (resource == gSelectedFolder) return;