Bug 1615996 - don't assert for missing draftid - warn only. r=jorgk DONTBUILD
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Fri, 22 May 2020 12:54:42 +0300
changeset 39214 6a077945683b32ef107dca9ceb7ed9959a5bc5c7
parent 39213 f8310228f5b2c75ff65bbb4e182eb6ce693c6e28
child 39215 17a3b9a2aeedb1652edd44b506dc037679ff5d4c
push id402
push userclokep@gmail.com
push dateMon, 29 Jun 2020 20:48:04 +0000
reviewersjorgk
bugs1615996
Bug 1615996 - don't assert for missing draftid - warn only. r=jorgk DONTBUILD
mailnews/compose/src/nsMsgCompose.cpp
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -1743,19 +1743,16 @@ nsresult nsMsgCompose::CreateMessage(con
       }
       m_compFields->SetBcc(bccList.get());
     }
   }
 
   if (mType == nsIMsgCompType::Draft) {
     nsCString curDraftIdURL;
     rv = m_compFields->GetDraftId(getter_Copies(curDraftIdURL));
-    NS_ASSERTION(NS_SUCCEEDED(rv) && !curDraftIdURL.IsEmpty(),
-                 "CreateMessage can't get draft id");
-
     // Skip if no draft id (probably a new draft msg).
     if (NS_SUCCEEDED(rv) && !curDraftIdURL.IsEmpty()) {
       nsCOMPtr<nsIMsgDBHdr> msgDBHdr;
       rv = GetMsgDBHdrFromURI(curDraftIdURL.get(), getter_AddRefs(msgDBHdr));
       NS_ASSERTION(NS_SUCCEEDED(rv),
                    "CreateMessage can't get msg header DB interface pointer.");
       if (msgDBHdr) {
         nsCString queuedDisposition;
@@ -1770,16 +1767,18 @@ nsresult nsMsgCompose::CreateMessage(con
         mOriginalMsgURI = originalMsgURIfromDB;
         if (!queuedDisposition.IsEmpty()) {
           if (queuedDisposition.EqualsLiteral("replied"))
             mDraftDisposition = nsIMsgFolder::nsMsgDispositionState_Replied;
           else if (queuedDisposition.EqualsLiteral("forward"))
             mDraftDisposition = nsIMsgFolder::nsMsgDispositionState_Forwarded;
         }
       }
+    } else {
+      NS_WARNING("CreateMessage can't get draft id");
     }
   }
 
   // If we don't have an original message URI, nothing else to do...
   if (!originalMsgURI || *originalMsgURI == 0) return NS_OK;
 
   // store the original message URI so we can extract it after we send the
   // message to properly mark any disposition flags like replied or forwarded on
@@ -3647,23 +3646,23 @@ nsresult nsMsgComposeSendListener::Remov
 
   rv = compObj->GetCompFields(getter_AddRefs(compFields));
   NS_ASSERTION(NS_SUCCEEDED(rv),
                "RemoveCurrentDraftMessage can't get compose fields");
   if (NS_FAILED(rv) || !compFields) return rv;
 
   nsCString curDraftIdURL;
   rv = compFields->GetDraftId(getter_Copies(curDraftIdURL));
-  NS_ASSERTION(NS_SUCCEEDED(rv),
-               "RemoveCurrentDraftMessage can't get draft id");
 
   // Skip if no draft id (probably a new draft msg).
   if (NS_SUCCEEDED(rv) && !curDraftIdURL.IsEmpty()) {
     rv = RemoveDraftOrTemplate(compObj, curDraftIdURL, isSaveTemplate);
     if (NS_FAILED(rv)) NS_WARNING("Removing current draft failed");
+  } else {
+    NS_WARNING("RemoveCurrentDraftMessage can't get draft id");
   }
 
   if (isSaveTemplate) {
     nsCString templateIdURL;
     rv = compFields->GetTemplateId(getter_Copies(templateIdURL));
     if (NS_SUCCEEDED(rv) && !templateIdURL.Equals(curDraftIdURL)) {
       // Above we deleted an auto-saved draft, so here we need to delete
       // the original template.