Fix 'Note to self' NPE crash.
Do not allow sending messages if there are no available accounts.
Bug: 7353223
Change-Id: Ic0672038bac7f169a52e20cb42d70693c77fb313
diff --git a/src/com/android/mail/compose/ComposeActivity.java b/src/com/android/mail/compose/ComposeActivity.java
index 230408c..1106e30 100644
--- a/src/com/android/mail/compose/ComposeActivity.java
+++ b/src/com/android/mail/compose/ComposeActivity.java
@@ -2043,6 +2043,11 @@
*/
protected boolean sendOrSaveWithSanityChecks(final boolean save, final boolean showToast,
final boolean orientationChanged) {
+ if (mAccounts == null || mAccount == null) {
+ Toast.makeText(this, R.string.send_failed, Toast.LENGTH_SHORT).show();
+ return false;
+ }
+
String[] to, cc, bcc;
Editable body = mBodyView.getEditableText();
if (orientationChanged) {