Bug 1600507 - Deal with null gMsgFolderSelected. r=frg
authorIan Neal <iann_cvs@blueyonder.co.uk>
Thu, 12 Dec 2019 19:49:40 +0100
changeset 37745 f4555c61a7b9fa3d011baf1eada893392162ef81
parent 37744 8ef25eb8c092d8d57719260a8aa019e9b793dbd1
child 37746 bf911482c6797b0b499817bb195dad8f43a39b3b
push id397
push userclokep@gmail.com
push dateMon, 10 Feb 2020 21:16:13 +0000
reviewersfrg
bugs1600507
Bug 1600507 - Deal with null gMsgFolderSelected. r=frg
suite/mailnews/content/msgMail3PaneWindow.js
--- a/suite/mailnews/content/msgMail3PaneWindow.js
+++ b/suite/mailnews/content/msgMail3PaneWindow.js
@@ -211,34 +211,38 @@ var folderListener =
             // Scroll to message for virtual folders is done in
             // gSearchNotificationListener.OnSearchDone (see searchBar.js).
             if (!scrolled && !(gMsgFolderSelected.flags & nsMsgFolderFlags.Virtual))
               ScrollToMessageAfterFolderLoad(msgFolder);
             SetBusyCursor(window, false);
           }
           // Folder loading is over,
           // now issue quick search if there is an email address.
-          viewDebug("in folder loaded gVirtualFolderTerms = " + gVirtualFolderTerms + "\n");
-          viewDebug("in folder loaded gMsgFolderSelected = " +
-                    gMsgFolderSelected && gMsgFolderSelected.URI + "\n");
+          if (gVirtualFolderTerms)
+            viewDebug("in folder loaded gVirtualFolderTerms = " +
+                      gVirtualFolderTerms + "\n");
+          if (gMsgFolderSelected)
+            viewDebug("in folder loaded gMsgFolderSelected = " +
+                      gMsgFolderSelected.URI + "\n");
           if (rerootingFolder)
           {
             if (gSearchEmailAddress)
             {
               Search(gSearchEmailAddress);
               gSearchEmailAddress = null;
             }
             else if (gVirtualFolderTerms)
             {
               gDefaultSearchViewTerms = null;
               viewDebug("searching gVirtualFolderTerms\n");
               gDBView.viewFolder = gMsgFolderSelected;
               ViewChangeByFolder(gMsgFolderSelected);
             }
-            else if (gMsgFolderSelected.flags & nsMsgFolderFlags.Virtual)
+            else if (gMsgFolderSelected &&
+                     gMsgFolderSelected.flags & nsMsgFolderFlags.Virtual)
             {
               viewDebug("selected folder is virtual\n");
               gDefaultSearchViewTerms = null;
             }
             else
             {
               // Get the view value from the folder.
               if (msgFolder)