From 4288789e395e147791cf539ff03151389ca5ba38 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 10 Apr 2012 22:26:21 -0400 Subject: [PATCH] BF: mAccount must not be accessed before verfied to be non-null otherwise obviously leads to crashes. IMHO this was a logical location to move, and it resolved my issue when account was not yet accessible due to not yet accepted key upon importing old settings from a stored file --- src/com/fsck/k9/activity/MessageList.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index ddfd7bd7f..48c810915 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -820,15 +820,14 @@ public class MessageList mStars = K9.messageListStars(); mCheckboxes = K9.messageListCheckboxes(); - mSortType = mAccount.getSortType(); - mSortAscending = mAccount.isSortAscending(mSortType); - mSortDateAscending = mAccount.isSortAscending(SortType.SORT_DATE); - mController.addListener(mAdapter.mListener); Account[] accountsWithNotification; if (mAccount != null) { accountsWithNotification = new Account[] { mAccount }; + mSortType = mAccount.getSortType(); + mSortAscending = mAccount.isSortAscending(mSortType); + mSortDateAscending = mAccount.isSortAscending(SortType.SORT_DATE); } else { Preferences preferences = Preferences.getPreferences(this); accountsWithNotification = preferences.getAccounts();