Bug 1580187 - Add null check to avoid crash in nsImapService::NewChannel(). r=mkmelin a=jorgk
authorJorg K <jorgk@jorgk.com>
Fri, 13 Sep 2019 10:34:17 +0200
changeset 35769 3a71c5c5ccc1f7f188d5fe4de94900d516769aaa
parent 35768 b01e94099186d0733b63128950811c00ad3fdfcc
child 35770 01771e7596ed29af3c7030c2656f312f92303c8c
push id2494
push usermozilla@jorgk.com
push dateMon, 16 Sep 2019 22:28:21 +0000
treeherdercomm-beta@4a39edafeb8e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, jorgk
bugs1580187
Bug 1580187 - Add null check to avoid crash in nsImapService::NewChannel(). r=mkmelin a=jorgk
mailnews/imap/src/nsImapService.cpp
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -2532,19 +2532,18 @@ NS_IMETHODIMP nsImapService::NewChannel(
     nsCOMPtr<nsIMsgFolder> parent;
     if (aFolder) aFolder->GetParent(getter_AddRefs(parent));
     nsCString serverKey;
     nsAutoCString userPass;
     rv = mailnewsUrl->GetUserPass(userPass);
     server->GetKey(serverKey);
     nsCString fullFolderName;
     if (parent) fullFolderName = folderName;
-    if (!parent &&
-        !folderName.IsEmpty())  // check if this folder is another user's folder
-    {
+    if (!parent && !folderName.IsEmpty() && imapRoot) {
+      // Check if this folder is another user's folder.
       fullFolderName =
           nsIMAPNamespaceList::GenerateFullFolderNameWithDefaultNamespace(
               serverKey.get(), folderName.get(), userPass.get(),
               kOtherUsersNamespace, nullptr);
       // if this is another user's folder, let's see if we're already subscribed
       // to it.
       rv = imapRoot->FindOnlineSubFolder(fullFolderName,
                                          getter_AddRefs(subFolder));