Fix NPE sending mail on servers without Outbox folders

* stopPing (in SyncManager) assumes that every mailbox has a serverId
  but this is not the case on some servers, in which case we hit an
  NPE during a check for the account mailbox
* Check for a null serverId when testing for the account mailbox

Bug: 2606385
Change-Id: Idfa8abd8ef9e2c0a2ac01d0b168a21c934f6fdf3
This commit is contained in:
Marc Blank 2010-04-19 21:19:05 -07:00
parent 075d34947f
commit bb11c91175

View File

@ -1651,8 +1651,9 @@ public class SyncManager extends Service implements Runnable {
for (long mailboxId: mServiceMap.keySet()) {
Mailbox m = Mailbox.restoreMailboxWithId(this, mailboxId);
if (m != null) {
if (m.mAccountKey == accountId &&
m.mServerId.startsWith(Eas.ACCOUNT_MAILBOX_PREFIX)) {
String serverId = m.mServerId;
if (m.mAccountKey == accountId && serverId != null &&
serverId.startsWith(Eas.ACCOUNT_MAILBOX_PREFIX)) {
// Here's our account mailbox; reset him (stopping pings)
AbstractSyncService svc = mServiceMap.get(mailboxId);
svc.reset();