From 4a3b2ef641ccdbf123cdcb4483ec37b86e07b91b Mon Sep 17 00:00:00 2001 From: Juergen Date: Tue, 5 Sep 2023 15:23:08 +0200 Subject: [PATCH] Android: add try catch around dialog.dismiss() to prevent crashes --- src/android/InAppBrowser.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 76dc150cc..849d5c36f 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -533,7 +533,11 @@ public void run() { // NB: wait for about:blank before dismissing public void onPageFinished(WebView view, String url) { if (dialog != null && !cordova.getActivity().isFinishing()) { - dialog.dismiss(); + try { + dialog.dismiss(); + } catch(IllegalArgumentException e) { + LOG.e(LOG_TAG, "Caught exception when trying to close IAB dialog: " + e); + } dialog = null; } }