From fa5ba9e02bde82802f2489aa513d3b6ab7c56d8d Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 5 Dec 2018 09:27:10 +0100 Subject: [PATCH] fixed some rare NPE caused by race for saveInstanceState() --- .../java/eu/siacs/conversations/ui/ConversationFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 7e001a55c..57af66a9e 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -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();