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
This commit is contained in:
Marc Blank 2009-11-18 11:11:23 -08:00
parent 6b93f61eea
commit bdb28c1644

View File

@ -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;
}