aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-04-29 23:30:37 +0200
committerChristian Schneppe <christian@pix-art.de>2018-04-29 23:30:37 +0200
commitaad570487367903f16ccd971f02d1c8ba5a9e934 (patch)
tree00d9a0f4cfa2f0cf87b9876f07df021bd4073462 /src/main/java/de/pixart/messenger/ui
parent02718edf44e6d23504a71ae9266a6c675913a75b (diff)
properly catch and ignore IllegalStateException instead of using commitAllowStateLoss
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationsActivity.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
index 06ab8ec89..d7f4bd88e 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
@@ -494,7 +494,13 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.main_fragment, conversationFragment);
fragmentTransaction.addToBackStack(null);
- fragmentTransaction.commitAllowingStateLoss(); //allowing state loss is probably fine since view intents at all are already stored and a click can probably be 'ignored'
+ try {
+ fragmentTransaction.commit();
+ } catch (IllegalStateException e) {
+ Log.w(Config.LOGTAG, "sate loss while opening conversation", e);
+ //allowing state loss is probably fine since view intents et all are already stored and a click can probably be 'ignored'
+ return;
+ }
}
} else {
mainNeedsRefresh = true;
@@ -829,7 +835,12 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
}
Fragment mainFragment = getFragmentManager().findFragmentById(R.id.main_fragment);
if (mainFragment != null && mainFragment instanceof ConversationFragment) {
- getFragmentManager().popBackStack();
+ try {
+ getFragmentManager().popBackStack();
+ } catch (IllegalStateException e) {
+ Log.w(Config.LOGTAG, "state loss while popping back state after archiving conversation", e);
+ //this usually means activity is no longer active; meaning on the next open we will run through this again
+ }
return;
}
Fragment secondaryFragment = getFragmentManager().findFragmentById(R.id.secondary_fragment);