Avoid NullPointerException in SubjectComparator
This commit is contained in:
parent
c4799d20f0
commit
ce0308f528
1 changed files with 6 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue