Bug 1510472 - Add null check to avoid crash due to nsDependentCString(null). r=mkmelin DONTBUILD
authorJorg K <jorgk@jorgk.com>
Wed, 28 Nov 2018 10:14:26 +0100
changeset 33793 e5ce0ede4824625ab4dfa929f66dfcf37b86ba31
parent 33792 9a840a138dbef9bb952620f827c1c9f36ee19246
child 33794 997316def2a1f266e97df8bc9a2ab0b824e3c1f8
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersmkmelin
bugs1510472
Bug 1510472 - Add null check to avoid crash due to nsDependentCString(null). r=mkmelin DONTBUILD
mailnews/mapi/mapihook/src/msgMapiHook.cpp
--- a/mailnews/mapi/mapihook/src/msgMapiHook.cpp
+++ b/mailnews/mapi/mapihook/src/msgMapiHook.cpp
@@ -306,17 +306,18 @@ nsresult nsMapiHook::BlindSendMail (unsi
   // populate the compose params
   bool forcePlainText;
   aCompFields->GetForcePlainText(&forcePlainText);
   pMsgComposeParams->SetType(nsIMsgCompType::New);
   pMsgComposeParams->SetFormat(forcePlainText ? nsIMsgCompFormat::PlainText : nsIMsgCompFormat::HTML);
   pMsgComposeParams->SetIdentity(pMsgId);
   pMsgComposeParams->SetComposeFields(aCompFields);
   pMsgComposeParams->SetSendListener(sendListener) ;
-  pMsgComposeParams->SetSmtpPassword(nsDependentString(password));
+  if (password)
+    pMsgComposeParams->SetSmtpPassword(nsDependentString(password));
 
   // create the nsIMsgCompose object to send the object
   nsCOMPtr<nsIMsgCompose> pMsgCompose (do_CreateInstance(NS_MSGCOMPOSE_CONTRACTID, &rv));
   if (NS_FAILED(rv) || (!pMsgCompose) ) return rv ;
 
   /** initialize nsIMsgCompose, Send the message, wait for send completion response **/
 
   rv = pMsgCompose->Initialize(pMsgComposeParams, hiddenWindow, nullptr);