Merge change 27048 into eclair

* changes:
  Harden a few calls in Controller
This commit is contained in:
Android (Google) Code Review 2009-09-25 13:32:45 -04:00
commit bce49bb3f5

View File

@ -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.