Prevent NPE with badly-timed account deletion

Bug: 5473621
Change-Id: I0956540de0de172bc3519a301598e197b449b9a8
This commit is contained in:
Marc Blank 2011-10-18 13:27:30 -07:00
parent c36dcfbdb1
commit 3285fb3cfd
2 changed files with 6 additions and 0 deletions

View File

@ -364,6 +364,8 @@ public class MessagingController implements Runnable {
// Select generic sync or store-specific sync
SyncResults results = synchronizeMailboxGeneric(account, folder);
// The account might have been deleted
if (results == null) return;
mListeners.synchronizeMailboxFinished(account.mId, folder.mId,
results.mTotalMessages,
results.mAddedMessages.size(),
@ -771,6 +773,8 @@ public class MessagingController implements Runnable {
// 2. Open the remote folder and create the remote folder if necessary
Store remoteStore = Store.getInstance(account, mContext);
// The account might have been deleted
if (remoteStore == null) return null;
Folder remoteFolder = remoteStore.getFolder(mailbox.mServerId);
/*

View File

@ -88,6 +88,8 @@ public abstract class Store {
public synchronized static Store getInstance(Account account, Context context)
throws MessagingException {
HostAuth hostAuth = account.getOrCreateHostAuthRecv(context);
// An existing account might have been deleted
if (hostAuth == null) return null;
Store store = sStores.get(hostAuth);
if (store == null) {
Context appContext = context.getApplicationContext();