mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-11 21:58:35 -05:00
message view / list: fix NPE when list is empty
This happened for example in a starred-message-only view when un-starting the last message. This led to isFirst() and isLast() causing a NullPointerException when trying to update the previous / next buttons.
This commit is contained in:
parent
9287d97626
commit
dd5d8561cd
@ -2873,11 +2873,11 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
||||
}
|
||||
|
||||
public boolean isFirst(MessageReference messageReference) {
|
||||
return messageReference.equals(getReferenceForPosition(0));
|
||||
return mAdapter.isEmpty() || messageReference.equals(getReferenceForPosition(0));
|
||||
}
|
||||
|
||||
public boolean isLast(MessageReference messageReference) {
|
||||
return messageReference.equals(getReferenceForPosition(mAdapter.getCount() - 1));
|
||||
return mAdapter.isEmpty() || messageReference.equals(getReferenceForPosition(mAdapter.getCount() - 1));
|
||||
}
|
||||
|
||||
private MessageReference getReferenceForPosition(int position) {
|
||||
|
Loading…
Reference in New Issue
Block a user