From d696c6f2dfb10de81213fed283a5514bc7cf2c60 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Wed, 19 Aug 2009 20:31:18 -0700 Subject: [PATCH] Add checks to avoid NPE's while stopping services --- src/com/android/exchange/SyncManager.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java index c07ed124e..87d0fbbb2 100644 --- a/src/com/android/exchange/SyncManager.java +++ b/src/com/android/exchange/SyncManager.java @@ -983,9 +983,13 @@ public class SyncManager extends Service implements Runnable { // Shut down all of those running services for (Long mailboxId : toStop) { AbstractSyncService svc = mServiceMap.get(mailboxId); - log("Shutting down " + svc.mAccount.mDisplayName + '/' + svc.mMailbox.mDisplayName); - svc.stop(); - svc.mThread.interrupt(); + if (svc != null) { + log("Stopping " + svc.mAccount.mDisplayName + '/' + svc.mMailbox.mDisplayName); + svc.stop(); + if (svc.mThread != null) { + svc.mThread.interrupt(); + } + } releaseWakeLock(mailboxId); } }