Bug 1275948 - fix crash in nsMsgMaildirStore::GetNewMsgOutputStream(). r=jorgk a=jorgk BETA_60_CONTINUATION
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Mon, 27 Aug 2018 19:10:28 +0300
branchBETA_60_CONTINUATION
changeset 32454 3631b10bbfed
parent 32453 116b05cad1af
child 32455 f1db5fa3f2fa
push id385
push userclokep@gmail.com
push dateTue, 04 Sep 2018 23:26:14 +0000
reviewersjorgk, jorgk
bugs1275948
Bug 1275948 - fix crash in nsMsgMaildirStore::GetNewMsgOutputStream(). r=jorgk a=jorgk
mailnews/local/src/nsMsgMaildirStore.cpp
--- a/mailnews/local/src/nsMsgMaildirStore.cpp
+++ b/mailnews/local/src/nsMsgMaildirStore.cpp
@@ -583,21 +583,18 @@ nsMsgMaildirStore::GetNewMsgOutputStream
   NS_ENSURE_ARG_POINTER(aFolder);
   NS_ENSURE_ARG_POINTER(aNewMsgHdr);
   NS_ENSURE_ARG_POINTER(aReusable);
   NS_ENSURE_ARG_POINTER(aResult);
 
   *aReusable = false; // message per file
 
   nsCOMPtr<nsIMsgDatabase> db;
-  aFolder->GetMsgDatabase(getter_AddRefs(db));
-  if (!db)
-    NS_ERROR("no db");
-
-  nsresult rv;
+  nsresult rv = aFolder->GetMsgDatabase(getter_AddRefs(db));
+  NS_ENSURE_SUCCESS(rv, rv);
 
   if (!*aNewMsgHdr)
   {
     rv = db->CreateNewHdr(nsMsgKey_None, aNewMsgHdr);
     NS_ENSURE_SUCCESS(rv, rv);
 
   }
   (*aNewMsgHdr)->SetMessageOffset(0);