summaryrefslogtreecommitdiffstats
path: root/mailnews/compose
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-10 22:51:10 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-10 22:51:10 -0500
commit5d21f962db500a22697221d985709d5f24fa27f5 (patch)
tree76abad17d6a77770009f6b19ea3cc2b3cb9e88aa /mailnews/compose
parent2fda56a84eca7a08f626704e81b5c4c571623e44 (diff)
downloadUXP-5d21f962db500a22697221d985709d5f24fa27f5.tar
UXP-5d21f962db500a22697221d985709d5f24fa27f5.tar.gz
UXP-5d21f962db500a22697221d985709d5f24fa27f5.tar.lz
UXP-5d21f962db500a22697221d985709d5f24fa27f5.tar.xz
UXP-5d21f962db500a22697221d985709d5f24fa27f5.zip
Bug 342632 - Allow defaultAccount to return success with nullptr result when there is no usable account.
Tag #1273
Diffstat (limited to 'mailnews/compose')
-rw-r--r--mailnews/compose/src/nsMsgComposeService.cpp2
-rw-r--r--mailnews/compose/src/nsMsgSendLater.cpp13
2 files changed, 11 insertions, 4 deletions
diff --git a/mailnews/compose/src/nsMsgComposeService.cpp b/mailnews/compose/src/nsMsgComposeService.cpp
index bc202b7df..bec88f8fe 100644
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -619,7 +619,7 @@ nsMsgComposeService::GetDefaultIdentity(nsIMsgIdentity **_retval)
rv = accountManager->GetDefaultAccount(getter_AddRefs(defaultAccount));
NS_ENSURE_SUCCESS(rv, rv);
- return defaultAccount->GetDefaultIdentity(_retval);
+ return defaultAccount ? defaultAccount->GetDefaultIdentity(_retval) : NS_OK;
}
/* readonly attribute boolean logComposePerformance; */
diff --git a/mailnews/compose/src/nsMsgSendLater.cpp b/mailnews/compose/src/nsMsgSendLater.cpp
index 66c90fc0b..ad0fb2031 100644
--- a/mailnews/compose/src/nsMsgSendLater.cpp
+++ b/mailnews/compose/src/nsMsgSendLater.cpp
@@ -509,6 +509,8 @@ nsMsgSendLater::CompleteMailFileSend()
nsCOMPtr<nsIMsgIdentity> identity;
nsresult rv = GetIdentityFromKey(mIdentityKey, getter_AddRefs(identity));
NS_ENSURE_SUCCESS(rv,rv);
+ if (!identity)
+ return NS_ERROR_UNEXPECTED;
// If for some reason the tmp file didn't get created, we've failed here
bool created;
@@ -634,6 +636,8 @@ nsMsgSendLater::StartNextMailFileSend(nsresult prevStatus)
nsCOMPtr<nsIMsgIdentity> identity;
rv = GetIdentityFromKey(identityKey.get(), getter_AddRefs(identity));
NS_ENSURE_SUCCESS(rv, rv);
+ if (!identity)
+ return NS_ERROR_UNEXPECTED;
// Notify that we're just about to start sending this message
NotifyListenersOnMessageStartSending(mTotalSendCount, mMessagesToSend.Count(),
@@ -1427,14 +1431,17 @@ nsMsgSendLater::GetIdentityFromKey(const char *aKey, nsIMsgIdentity **aIdentity
}
}
- // if no aKey, or we failed to find the identity from the key
+ // If no aKey, or we failed to find the identity from the key
// use the identity from the default account.
nsCOMPtr<nsIMsgAccount> defaultAccount;
rv = accountManager->GetDefaultAccount(getter_AddRefs(defaultAccount));
NS_ENSURE_SUCCESS(rv,rv);
- rv = defaultAccount->GetDefaultIdentity(aIdentity);
- NS_ENSURE_SUCCESS(rv,rv);
+ if (defaultAccount)
+ rv = defaultAccount->GetDefaultIdentity(aIdentity);
+ else
+ *aIdentity = nullptr;
+
return rv;
}