From 4d4f63be20d59f97115460f93e289288f0dce31e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 18 Nov 2018 17:08:37 +0100 Subject: [PATCH] do not display toast if activity is finishing --- .../siacs/conversations/ui/ConferenceDetailsActivity.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index a6fa255d6..71ba683c7 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -698,11 +698,10 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers private void displayToast(final String msg) { runOnUiThread(() -> { - try { - Toast.makeText(ConferenceDetailsActivity.this, msg, Toast.LENGTH_SHORT).show(); - } catch (WindowManager.BadTokenException e) { - Log.e(Config.LOGTAG,"unable to display toast '"+msg+"'. Activity not running"); + if (isFinishing()) { + return; } + Toast.makeText(ConferenceDetailsActivity.this, msg, Toast.LENGTH_SHORT).show(); }); }