From bb11c91175a4beee207324d67b913b91a41bbea7 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Mon, 19 Apr 2010 21:19:05 -0700 Subject: [PATCH] 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 --- src/com/android/exchange/SyncManager.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java index f9554891b..5eb7b2d82 100644 --- a/src/com/android/exchange/SyncManager.java +++ b/src/com/android/exchange/SyncManager.java @@ -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();