From 38203a3fde183943da123ab5ec0ed6243c431761 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Wed, 21 Oct 2009 12:41:57 -0700 Subject: [PATCH] Fix timing-dependent crash in Medium tests (#2202726) Change-Id: I218079f24f1ce08d770624d1272e1d9a46c1be26 --- src/com/android/exchange/EasSyncService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/com/android/exchange/EasSyncService.java b/src/com/android/exchange/EasSyncService.java index 0f2a34594..8f74cd6d3 100644 --- a/src/com/android/exchange/EasSyncService.java +++ b/src/com/android/exchange/EasSyncService.java @@ -1039,26 +1039,29 @@ public class EasSyncService extends AbstractSyncService { mExitStatus = EXIT_DONE; } - protected void setupService() { + protected boolean setupService() { // Make sure account and mailbox are always the latest from the database mAccount = Account.restoreAccountWithId(mContext, mAccount.mId); + if (mAccount == null) return false; mMailbox = Mailbox.restoreMailboxWithId(mContext, mMailbox.mId); - + if (mMailbox == null) return false; mThread = Thread.currentThread(); android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND); TAG = mThread.getName(); HostAuth ha = HostAuth.restoreHostAuthWithId(mContext, mAccount.mHostAuthKeyRecv); + if (ha == null) return false; mHostAddress = ha.mAddress; mUserName = ha.mLogin; mPassword = ha.mPassword; + return true; } /* (non-Javadoc) * @see java.lang.Runnable#run() */ public void run() { - setupService(); + if (!setupService()) return; try { SyncManager.callback().syncMailboxStatus(mMailboxId, EmailServiceStatus.IN_PROGRESS, 0);