Bug 1523904 - Fix crash in nsAbCardProperty::SetUID(). r=darktrojan a=jorgk
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Wed, 06 Feb 2019 10:17:00 +0100
changeset 34324 9378f2d586b07b4adef8802297ffa2bbf4dd3363
parent 34323 306a8f3a372d36bede07c7d438e308be54121c89
child 34325 7759b93fc8dd484d38a2596e65f86ac1516f0a40
push id389
push userclokep@gmail.com
push dateMon, 18 Mar 2019 19:01:53 +0000
reviewersdarktrojan, jorgk
bugs1523904
Bug 1523904 - Fix crash in nsAbCardProperty::SetUID(). r=darktrojan a=jorgk
mailnews/addrbook/src/nsAbCardProperty.cpp
--- a/mailnews/addrbook/src/nsAbCardProperty.cpp
+++ b/mailnews/addrbook/src/nsAbCardProperty.cpp
@@ -381,17 +381,17 @@ NS_IMETHODIMP nsAbCardProperty::SetUID(c
 
   nsCOMPtr<nsIAbManager> abManager = do_GetService(NS_ABMANAGER_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr <nsIAbDirectory> directory = nullptr;
   rv = abManager->GetDirectoryFromId(directoryId, getter_AddRefs(directory));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return directory->ModifyCard(this);
+  return directory ? directory->ModifyCard(this) : NS_OK;
 }
 
 NS_IMETHODIMP nsAbCardProperty::GetFirstName(nsAString &aString)
 {
   nsresult rv = GetPropertyAsAString(kFirstNameProperty, aString);
   if (rv == NS_ERROR_NOT_AVAILABLE)
   {
     aString.Truncate();