Bug 837552, crash in nsMsgDatabase::CopyHdrFromExistingHdr with filters, r=neil, a=rkent
authorR Kent James <rkent@caspia.com>
Wed, 01 Jul 2015 13:19:21 -0700
changeset 22131 d3ba1db5d36629203f5d8d4d3c31d9c4c98e4114
parent 22130 1b47ff562afca161c5fee9647f65c9dd595ec54e
child 22132 0a8994d729d605fbada2ca27c51b22f912ff1b90
push id17
push userkent@caspia.com
push dateWed, 01 Jul 2015 23:34:32 +0000
treeherdercomm-esr38@0a8994d729d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersneil, rkent
bugs837552
Bug 837552, crash in nsMsgDatabase::CopyHdrFromExistingHdr with filters, r=neil, a=rkent
mailnews/db/msgdb/src/nsMsgDatabase.cpp
--- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp
@@ -3537,16 +3537,19 @@ NS_IMETHODIMP nsMsgDatabase::CopyHdrFrom
     nsMsgHdr* sourceMsgHdr = static_cast<nsMsgHdr*>(existingHdr);      // closed system, cast ok
     nsMsgHdr *destMsgHdr = nullptr;
     CreateNewHdr(key, (nsIMsgDBHdr **) &destMsgHdr);
     nsIMdbRow  *sourceRow = sourceMsgHdr->GetMDBRow();
     if (!destMsgHdr || !sourceRow)
       return NS_MSG_MESSAGE_NOT_FOUND;
 
     nsIMdbRow  *destRow = destMsgHdr->GetMDBRow();
+    if (!destRow)
+      return NS_ERROR_UNEXPECTED;
+
     err = destRow->SetRow(GetEnv(), sourceRow);
     if (NS_SUCCEEDED(err))
     {
       // we may have gotten the header from a cache - calling SetRow
       // basically invalidates any cached values, so invalidate them.
       destMsgHdr->m_initedValues = 0;
       if(addHdrToDB)
         err = AddNewHdrToDB(destMsgHdr, true);