From bdb28c164494178fa5d62858c17876a8568470df Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Wed, 18 Nov 2009 11:11:23 -0800 Subject: [PATCH] Fix #2267475 (NPE when changing incoming settings for EAS) * When settings are changed, we loop through the sync error map, clearing mailboxes in the changed account that are in an error state. * It's possible that there are mailboxes referenced in the map that no longer exist. When trying to retrieve them from the provider, null is returned, but we're not checking for this case, and an NPE results. * The fix is simply to check for null, and clear the error map for the mailboxId that references a deleted mailbox Change-Id: I8c1c847090026fa1c53b09bbe6b12d864bce4df1 --- src/com/android/exchange/SyncManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java index 25f77377c..d0ee4bfaa 100644 --- a/src/com/android/exchange/SyncManager.java +++ b/src/com/android/exchange/SyncManager.java @@ -324,7 +324,10 @@ public class SyncManager extends Service implements Runnable { // If it's a login failure, look a little harder Mailbox m = Mailbox.restoreMailboxWithId(INSTANCE, mailboxId); // If it's for the account whose host has changed, clear the error - if (m.mAccountKey == accountId) { + // If the mailbox is no longer around, remove the entry in the map + if (m == null) { + INSTANCE.mSyncErrorMap.remove(mailboxId); + } else if (m.mAccountKey == accountId) { error.fatal = false; error.holdEndTime = 0; }