fix crash filtering pop3 mail to a folder whose db is out of date, r=neil, bug 713683
authorDavid Bienvenu <bienvenu@nventure.com>
Tue, 27 Dec 2011 14:25:33 -0800
changeset 10301 acd227a49aad5d9d0e3555d945ea5a5ad821a73b
parent 10300 378ab7f9d3bb14a77fe77b70fc0801e91ecd976d
child 10302 3b4cb1418917b1fd1c28cb131171da172cea352f
push id402
push userbugzilla@standard8.plus.com
push dateTue, 13 Mar 2012 21:17:18 +0000
treeherdercomm-beta@d080a8ebf16a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersneil, bug
bugs713683
fix crash filtering pop3 mail to a folder whose db is out of date, r=neil, bug 713683
mailnews/local/src/nsParseMailbox.cpp
--- a/mailnews/local/src/nsParseMailbox.cpp
+++ b/mailnews/local/src/nsParseMailbox.cpp
@@ -2520,24 +2520,26 @@ nsresult nsParseNewMailState::MoveIncorp
   }
 
   nsCOMPtr<nsIMsgLocalMailFolder> localFolder = do_QueryInterface(destIFolder);
   nsCOMPtr<nsIMsgDatabase> destMailDB;
 
   if (!localFolder)
     return NS_MSG_POP_FILTER_TARGET_ERROR;
 
-  rv = localFolder->GetDatabaseWOReparse(getter_AddRefs(destMailDB));
-  NS_ASSERTION(destMailDB, "failed to open mail db parsing folder");
-  nsCOMPtr<nsIMsgDBHdr> newHdr;
   // don't force upgrade in place - open the db here before we start writing to the
   // destination file because XP_Stat can return file size including bytes written...
+  rv = localFolder->GetDatabaseWOReparse(getter_AddRefs(destMailDB));
+  NS_WARN_IF_FALSE(destMailDB && NS_SUCCEEDED(rv),
+                   "failed to open mail db parsing folder");
+  nsCOMPtr<nsIMsgDBHdr> newHdr;
 
-  destMailDB->CopyHdrFromExistingHdr(nsMsgKey_None, mailHdr, PR_TRUE,
-                                     getter_AddRefs(newHdr));
+  if (destMailDB)
+    destMailDB->CopyHdrFromExistingHdr(nsMsgKey_None, mailHdr, true,
+                                       getter_AddRefs(newHdr));
   PRUint32 messageLength;
   mailHdr->GetMessageSize(&messageLength);
   rv = AppendMsgFromStream(inputStream, newHdr, messageLength,
                            destIFolder);
 
   if (NS_FAILED(rv))
   {
     if (destMailDB)