Harden MailboxUtilities against NPE's
Bug: 4501088
Change-Id: Icbaf7625ddf1dd82cb288efe6afe5059e99d424c
diff --git a/src/com/android/exchange/provider/MailboxUtilities.java b/src/com/android/exchange/provider/MailboxUtilities.java
index a455b53..17535f1 100644
--- a/src/com/android/exchange/provider/MailboxUtilities.java
+++ b/src/com/android/exchange/provider/MailboxUtilities.java
@@ -146,6 +146,7 @@
private static void setAccountSyncAdapterFlag(Context context, long accountId, boolean start) {
Account account = Account.restoreAccountWithId(context, accountId);
+ if (account == null) return;
// Set temporary flag indicating state of update of mailbox list
ContentValues cv = new ContentValues();
cv.put(Account.FLAGS, start ? (account.mFlags | ACCOUNT_MAILBOX_CHANGE_FLAG) :
@@ -182,6 +183,7 @@
// If our temporary flag is set, we were interrupted during an update
// First, make sure we're current (really fast w/ caching)
Account account = Account.restoreAccountWithId(context, accountId);
+ if (account == null) return;
if ((account.mFlags & ACCOUNT_MAILBOX_CHANGE_FLAG) != 0) {
Log.w(Logging.LOG_TAG, "Account " + account.mDisplayName +
" has inconsistent mailbox data; fixing up...");