From 3f84bb54f22593b0f1e629dae1fe91320b49b0cb Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 18 Dec 2012 21:12:40 +0100 Subject: [PATCH] Fix crash when deleting all messages in a thread Fixes issue 4772 --- src/com/fsck/k9/fragment/MessageListFragment.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/com/fsck/k9/fragment/MessageListFragment.java b/src/com/fsck/k9/fragment/MessageListFragment.java index c2e3ea38b..578eb75c4 100644 --- a/src/com/fsck/k9/fragment/MessageListFragment.java +++ b/src/com/fsck/k9/fragment/MessageListFragment.java @@ -2979,13 +2979,16 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick } if (mIsThreadDisplay) { - cursor.moveToFirst(); - mTitle = cursor.getString(SUBJECT_COLUMN); - mTitle = Utility.stripSubject(mTitle); - if (StringUtils.isNullOrEmpty(mTitle)) { - mTitle = getString(R.string.general_no_subject); + if (cursor.moveToFirst()) { + mTitle = cursor.getString(SUBJECT_COLUMN); + mTitle = Utility.stripSubject(mTitle); + if (StringUtils.isNullOrEmpty(mTitle)) { + mTitle = getString(R.string.general_no_subject); + } + refreshTitle(); + } else { + //TODO: empty thread view -> return to full message list } - refreshTitle(); } cleanupSelected(cursor);