Bug 615111 - fix crash at nsMsgThreadedDBView::AddKeys. r=benc a=mkmelin
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Tue, 28 Jan 2020 12:56:43 +0200
changeset 37898 58019f894ca640359219c1fdc11f88da9e3d7011
parent 37897 f61f39e9e87e830b476ce6d696ccef37eeaf3c50
child 37899 23b28595c244282bfafed736048e9d48e5b92033
push id397
push userclokep@gmail.com
push dateMon, 10 Feb 2020 21:16:13 +0000
reviewersbenc, mkmelin
bugs615111
Bug 615111 - fix crash at nsMsgThreadedDBView::AddKeys. r=benc a=mkmelin
mailnews/base/src/nsMsgThreadedDBView.cpp
--- a/mailnews/base/src/nsMsgThreadedDBView.cpp
+++ b/mailnews/base/src/nsMsgThreadedDBView.cpp
@@ -214,19 +214,20 @@ int32_t nsMsgThreadedDBView::AddKeys(nsM
     int32_t flag = threadFlag;
 
     // Skip ignored threads.
     if ((threadFlag & nsMsgMessageFlags::Ignored) &&
         !(m_viewFlags & nsMsgViewFlagsType::kShowIgnored))
       continue;
 
     // Skip ignored subthreads
-    nsCOMPtr<nsIMsgDBHdr> msgHdr;
-    m_db->GetMsgHdrForKey(pKeys[i], getter_AddRefs(msgHdr));
     if (!(m_viewFlags & nsMsgViewFlagsType::kShowIgnored)) {
+      nsCOMPtr<nsIMsgDBHdr> msgHdr;
+      m_db->GetMsgHdrForKey(pKeys[i], getter_AddRefs(msgHdr));
+      if (!msgHdr) continue;
       bool killed;
       msgHdr->GetIsKilled(&killed);
       if (killed) continue;
     }
 
     // By default, make threads collapsed unless we're only viewing new msgs.
 
     if (flag & MSG_VIEW_FLAG_HASCHILDREN) flag |= nsMsgMessageFlags::Elided;