From 68e1f070f1c2ea8fcdb9bfada68360eea9cef1af Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Mon, 10 Jul 2023 11:33:01 +0600 Subject: [PATCH] 1304-Catch_IllegalStateException_on_showing_exceptionDialog issue: https://gitlab.e.foundation/e/os/backlog/-/issues/1304 IllegalStateException can be thrown when showing the exceptionDialog. In that case, we just log the cause to the logcat instead of showing the dialog & stop the app crash. --- .../notes/exception/ExceptionDialogFragment.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/it/niedermann/owncloud/notes/exception/ExceptionDialogFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/exception/ExceptionDialogFragment.java index b460e0cab..adcde8705 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/exception/ExceptionDialogFragment.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/exception/ExceptionDialogFragment.java @@ -101,12 +101,16 @@ public class ExceptionDialogFragment extends AppCompatDialogFragment { @Override public void show(@NonNull FragmentManager manager, @Nullable String tag) { - if (manager.isDestroyed() || !manager.isStateSaved()) { + try { + if (manager.isDestroyed() || !manager.isStateSaved()) { + Log.e("ExceptionDialog can't be shown as the state is lost. The cause:\n\n" + getStackStrace()); + return; + } + + super.show(manager, tag); + } catch (IllegalStateException e) { Log.e("ExceptionDialog can't be shown as the state is lost. The cause:\n\n" + getStackStrace()); - return; } - - super.show(manager, tag); } @NonNull -- GitLab