From ce0308f528256f1311d04e9b17e0d92d506fa40c Mon Sep 17 00:00:00 2001 From: cketti Date: Sun, 31 Mar 2013 00:48:01 +0100 Subject: [PATCH] Avoid NullPointerException in SubjectComparator --- src/com/fsck/k9/fragment/MessageListFragment.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/com/fsck/k9/fragment/MessageListFragment.java b/src/com/fsck/k9/fragment/MessageListFragment.java index f0f5058ea..2a0c67b9c 100644 --- a/src/com/fsck/k9/fragment/MessageListFragment.java +++ b/src/com/fsck/k9/fragment/MessageListFragment.java @@ -303,6 +303,12 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick String subject1 = cursor1.getString(SUBJECT_COLUMN); String subject2 = cursor2.getString(SUBJECT_COLUMN); + if (subject1 == null) { + return (subject2 == null) ? 0 : -1; + } else if (subject2 == null) { + return 1; + } + return subject1.compareToIgnoreCase(subject2); } }