Bug 1510472 - Add null check to avoid crash due to nsDependentCString(null). r=mkmelin a=jorgk
authorJorg K <jorgk@jorgk.com>
Wed, 28 Nov 2018 10:14:26 +0100
changeset 33517 cb577e1c5a9ec73ac9f426a92f3cb16f0beeb064
parent 33516 ae1110c30db5c25634cd81ff2db544505dc75ce0
child 33518 4430faa4264c60c921601d72f611bf846b1b0394
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersmkmelin, jorgk
bugs1510472
Bug 1510472 - Add null check to avoid crash due to nsDependentCString(null). r=mkmelin a=jorgk
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);