From 5bcb36eb10c896c07b873fcbbab2610cfca58e5f Mon Sep 17 00:00:00 2001 From: Jay Shrauner Date: Tue, 24 Jun 2014 10:40:47 -0700 Subject: [PATCH] Fix NPE from null Folder Catch empty folder cursor in migrate() and log error message and continue as with other empty cursor handling in loop. Bug:15854046 Change-Id: I13c0a1909755f62f318d7c2b237adb03df68ba86 --- .../android/email/preferences/EmailPreferenceMigrator.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/android/email/preferences/EmailPreferenceMigrator.java b/src/com/android/email/preferences/EmailPreferenceMigrator.java index 1d746e7d3..99c9a66be 100644 --- a/src/com/android/email/preferences/EmailPreferenceMigrator.java +++ b/src/com/android/email/preferences/EmailPreferenceMigrator.java @@ -136,6 +136,11 @@ public class EmailPreferenceMigrator extends BasePreferenceMigrator { try { if (folderCursor.moveToFirst()) { folder = new Folder(folderCursor); + } else { + LogUtils.e(LOG_TAG, "Empty folder cursor for mailbox %s", + LogUtils.sanitizeName(LOG_TAG, + account.settings.defaultInbox.toString())); + continue; } } finally { folderCursor.close();