summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaiyiz <kaiyiz@codeaurora.org>2014-04-30 09:41:39 +0800
committerLorDClockaN <davor@losinj.com>2014-08-27 22:26:22 +0200
commita65fcc92f951d626b7ce9b23c9a5f4025b881191 (patch)
tree41c97b311d8689534e760660108cf09d39a840bc
parent505a0cfc994e642287494da30f0d124209e6f154 (diff)
Exchange: Fix NPE caused by the nonexistent account
During the action of syncing in onPerformSync(), if the querying account is deleted, content resolver will return a null cursor. When onPerformSync() continues to access this null cursor without check, NPE is thrown. Need to check the cursor. If it is null, there will be nothing to sync. So stop the performance and return. CRs-fixed: 655249 Change-Id: I857d800266a174ff1e94ab6ee2f959dcc9e5f258
-rw-r--r--src/com/android/exchange/service/EmailSyncAdapterService.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/com/android/exchange/service/EmailSyncAdapterService.java b/src/com/android/exchange/service/EmailSyncAdapterService.java
index 5aea0169..3dac3e2a 100644
--- a/src/com/android/exchange/service/EmailSyncAdapterService.java
+++ b/src/com/android/exchange/service/EmailSyncAdapterService.java
@@ -673,6 +673,10 @@ public class EmailSyncAdapterService extends AbstractSyncAdapterService {
final Account account;
final Cursor accountCursor = cr.query(Account.CONTENT_URI, Account.CONTENT_PROJECTION,
AccountColumns.EMAIL_ADDRESS + "=?", new String[] {acct.name}, null);
+ if (accountCursor == null) {
+ // The account with the name acct.name does not exist.
+ return;
+ }
try {
if (!accountCursor.moveToFirst()) {
// Could not load account.