fixed some rare NPE caused by race for saveInstanceState()

This commit is contained in:
Daniel Gultsch 2018-12-05 09:27:10 +01:00
parent c01bd38d00
commit fa5ba9e02b
1 changed files with 2 additions and 2 deletions

View File

@ -595,8 +595,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
private ScrollState getScrollPosition() {
final ListView listView = this.binding.messagesView;
if (listView.getCount() == 0 || listView.getLastVisiblePosition() == listView.getCount() - 1) {
final ListView listView = this.binding == null ? null : this.binding.messagesView;
if (listView == null || listView.getCount() == 0 || listView.getLastVisiblePosition() == listView.getCount() - 1) {
return null;
} else {
final int pos = listView.getFirstVisiblePosition();