From 4f22859acfc1a047a04ee0f3cad434485600ed26 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 17 Nov 2018 12:59:19 +0100 Subject: [PATCH] catch illegal state exception on fragment transaction --- .../conversations/ui/StartConversationActivity.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 03a1fe9ff..de526fc9c 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -1167,10 +1167,14 @@ public class StartConversationActivity extends XmppActivity implements XmppConne @NonNull @Override public Fragment instantiateItem(@NonNull ViewGroup container, int position) { - Fragment fragment = getItem(position); - FragmentTransaction trans = fragmentManager.beginTransaction(); + final Fragment fragment = getItem(position); + final FragmentTransaction trans = fragmentManager.beginTransaction(); trans.add(container.getId(), fragment, "fragment:" + position); - trans.commit(); + try { + trans.commit(); + } catch (IllegalStateException e) { + //ignore + } return fragment; }