From e892f6f978c18d1d43f94681f4d73f36d5f8a2cd Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Fri, 25 Sep 2009 09:24:56 -0700 Subject: [PATCH] Harden a few calls in Controller * Check for null account (situation in which the Account has been deleted) Change-Id: Iabd949c32443c7496a249ac5b7cdca22fc920a18 --- src/com/android/email/Controller.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/email/Controller.java b/src/com/android/email/Controller.java index 01ac9d1f2..e0539d465 100644 --- a/src/com/android/email/Controller.java +++ b/src/com/android/email/Controller.java @@ -741,7 +741,7 @@ public class Controller { private IEmailService getServiceForAccount(long accountId) { // TODO make this more efficient, caching the account, MUCH smaller lookup here, etc. Account account = EmailContent.Account.restoreAccountWithId(mProviderContext, accountId); - if (isMessagingController(account)) { + if (account == null || isMessagingController(account)) { return null; } else { return new EmailServiceProxy(mContext, SyncManager.class, mServiceCallback); @@ -755,6 +755,7 @@ public class Controller { * TODO this should use a cache because we'll be doing this a lot */ public boolean isMessagingController(EmailContent.Account account) { + if (account == null) return false; Store.StoreInfo info = Store.StoreInfo.getStoreInfo(account.getStoreUri(mProviderContext), mContext); // This null happens in testing.