Bug 1318776 - Silence JS TypeErrors in folderPane.js and messageWindow.js. r=aceman
authorJorg K <jorgk@jorgk.com>
Fri, 17 Feb 2017 17:05:44 +0100
changeset 27652 c52f5a6cdd14fa2c1d605889d24bd9b40a111c42
parent 27651 a3073627bd7bee94973b5d9cb8d0fb8d66f82b84
child 27653 6ee27a7af6cd3e7bd25f392048fd40160910275a
push idunknown
push userunknown
push dateunknown
reviewersaceman
bugs1318776
Bug 1318776 - Silence JS TypeErrors in folderPane.js and messageWindow.js. r=aceman
mail/base/content/folderPane.js
mail/base/content/messageWindow.js
--- a/mail/base/content/folderPane.js
+++ b/mail/base/content/folderPane.js
@@ -2181,17 +2181,17 @@ var gFolderTreeView = {
       return;
 
     this._persistItemClosed(aItem.URI);
 
     let index = this.getIndexOfFolder(aItem);
     if (index == null)
       return;
     // forget our parent's children; they'll get rebuilt
-    if (aRDFParentItem)
+    if (aRDFParentItem && this._rowMap[index]._parent)
       this._rowMap[index]._parent._children = null;
     let kidCount = 1;
     let walker = Number(index) + 1;
     while (walker < this.rowCount &&
            this._rowMap[walker].level > this._rowMap[index].level) {
       walker++;
       kidCount++;
     }
--- a/mail/base/content/messageWindow.js
+++ b/mail/base/content/messageWindow.js
@@ -241,16 +241,20 @@ StandaloneMessageDisplayWidget.prototype
     if (!this.isDummy)
       this.displayedUri = null;
 
     // We've loaded a message, so this should be set to false
     this.aboutToLoadMessage = false;
   },
 
   onSelectedMessagesChanged: function () {
+    // When switching folders, we won't have any selection for a while.
+    if (!this.folderDisplay.view.dbView)
+      return true;
+
     // If the message we're displaying is deleted, we won't have any selection
     // for a while, but we'll soon select a new message. So don't test the
     // selection count -- instead see if there are any messages in the db view
     // at all.
     if (!this.aboutToLoadMessage &&
         this.folderDisplay.view.dbView.rowCount == 0) {
       window.close();
       return true;