diff options
author | Andrew Sapperstein <asapperstein@google.com> | 2013-06-04 11:56:02 -0700 |
---|---|---|
committer | Andrew Sapperstein <asapperstein@google.com> | 2013-06-28 10:16:51 -0700 |
commit | 05e539a255ed3075109894f39c63cbec157d729f (patch) | |
tree | 8267cf73508a99a14681159936ba1669ea74833d | |
parent | dc81b82410dca8003d968caf148cd35b43f43dab (diff) | |
download | android_packages_apps_UnifiedEmail-05e539a255ed3075109894f39c63cbec157d729f.tar.gz android_packages_apps_UnifiedEmail-05e539a255ed3075109894f39c63cbec157d729f.tar.bz2 android_packages_apps_UnifiedEmail-05e539a255ed3075109894f39c63cbec157d729f.zip |
Prevent NPE.
Fixes b/9265059 by adding some null checks.
Also added some wtf logs so we can figure out
what is null.
Change-Id: I2c8c660effa63abdddaa3fa075952ed46681192b
-rw-r--r-- | src/com/android/mail/ui/TwoPaneController.java | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/com/android/mail/ui/TwoPaneController.java b/src/com/android/mail/ui/TwoPaneController.java index ede87fd20..f80072d26 100644 --- a/src/com/android/mail/ui/TwoPaneController.java +++ b/src/com/android/mail/ui/TwoPaneController.java @@ -406,13 +406,28 @@ public final class TwoPaneController extends AbstractActivityController { // inbox. This fixes b/9006969 so that on smaller tablets where we have this // hybrid one and two-pane mode, we will return to the inbox. On larger tablets, // we will instead exit the app. - } else if (mode == ViewMode.CONVERSATION_LIST - && !mAccount.settings.defaultInbox.equals(mFolder.uri) - && !mLayout.isExpansiveLayout()) { - loadAccountInbox(); - } else if (!preventClose) { - // There is nothing else to pop off the stack. - mActivity.finish(); + + } else { + // Adding some logging to see why one of these would be null + if (mAccount == null) { + LogUtils.wtf(LOG_TAG, new Throwable(), "mAccount is null"); + } + if (mFolder == null) { + LogUtils.wtf(LOG_TAG, new Throwable(), "mFolder is null"); + } + if (mLayout == null) { + LogUtils.wtf(LOG_TAG, new Throwable(), "mLayout is null"); + } + final boolean shouldLoadInbox = mode == ViewMode.CONVERSATION_LIST && + mAccount != null && mFolder != null && + !mAccount.settings.defaultInbox.equals(mFolder.uri) && + mLayout != null && !mLayout.isExpansiveLayout(); + if (shouldLoadInbox) { + loadAccountInbox(); + } else if (!preventClose) { + // There is nothing else to pop off the stack. + mActivity.finish(); + } } } } |