From dae4a30c472c034028f06603c8c92d25fb74fb29 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 14 Jun 2022 09:18:39 +0200 Subject: [PATCH] Prevent crash --- app/src/main/java/eu/faircode/email/FragmentGmail.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentGmail.java b/app/src/main/java/eu/faircode/email/FragmentGmail.java index 33d29cdaa1..b5e5944912 100644 --- a/app/src/main/java/eu/faircode/email/FragmentGmail.java +++ b/app/src/main/java/eu/faircode/email/FragmentGmail.java @@ -606,8 +606,8 @@ public class FragmentGmail extends FragmentBase { protected void onExecuted(Bundle args, Void data) { boolean updated = args.getBoolean("updated"); if (updated) { - finish(); ToastEx.makeText(getContext(), R.string.title_setup_oauth_updated, Toast.LENGTH_LONG).show(); + finish(); } else { FragmentDialogAccount fragment = new FragmentDialogAccount(); fragment.setArguments(args); @@ -620,6 +620,9 @@ public class FragmentGmail extends FragmentBase { protected void onException(Bundle args, Throwable ex) { Log.e(ex); + if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) + return; + if (ex instanceof IllegalArgumentException) tvError.setText(ex.getMessage()); else