diff --git a/CHANGELOG.md b/CHANGELOG.md index e267b9c4..75822993 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,18 @@ -## 5.4.3+1 +## 5.4.3+2 - Fixed "Latest version 5.4.3 crashes on Android" [#1159](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1159) +## 5.4.3+1 + +- Try to fix "Latest version 5.4.3 crashes on Android" [#1159](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1159) + ## 5.4.3 - Added Bitwise OR operator support for `AndroidActionModeMenuItem` class ## 5.4.2+1 -- Fixed "Latest version 5.4.2 crashes on Android - HeadlessInAppWebView.dispose" [#1155](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1155) +- Try to fix "Latest version 5.4.2 crashes on Android - HeadlessInAppWebView.dispose" [#1155](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1155) ## 5.4.2 diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/headless_in_app_webview/HeadlessInAppWebViewManager.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/headless_in_app_webview/HeadlessInAppWebViewManager.java index 92916147..8395a29c 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/headless_in_app_webview/HeadlessInAppWebViewManager.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/headless_in_app_webview/HeadlessInAppWebViewManager.java @@ -84,7 +84,9 @@ public class HeadlessInAppWebViewManager implements MethodChannel.MethodCallHand channel.setMethodCallHandler(null); Collection headlessInAppWebViews = webViews.values(); for (HeadlessInAppWebView headlessInAppWebView : headlessInAppWebViews) { - headlessInAppWebView.dispose(); + if (headlessInAppWebView != null) { + headlessInAppWebView.dispose(); + } } webViews.clear(); } diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java index caf817a1..40276aeb 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java @@ -55,7 +55,7 @@ public class InAppBrowserActivity extends AppCompatActivity implements InAppBrow public ActionBar actionBar; public Menu menu; public SearchView searchView; - public InAppBrowserOptions options; + public InAppBrowserOptions options = new InAppBrowserOptions(); public ProgressBar progressBar; public boolean isHidden = false; public String fromActivity; @@ -75,7 +75,10 @@ public class InAppBrowserActivity extends AppCompatActivity implements InAppBrow String managerId = b.getString("managerId"); manager = InAppBrowserManager.shared.get(managerId); if (manager == null || manager.plugin == null|| manager.plugin.messenger == null) return; - + + Map optionsMap = (Map) b.getSerializable("options"); + options.parse(optionsMap); + windowId = b.getInt("windowId"); channel = new MethodChannel(manager.plugin.messenger, "com.pichillilorenzo/flutter_inappbrowser_" + id); @@ -102,13 +105,9 @@ public class InAppBrowserActivity extends AppCompatActivity implements InAppBrow fromActivity = b.getString("fromActivity"); - Map optionsMap = (Map) b.getSerializable("options"); Map contextMenu = (Map) b.getSerializable("contextMenu"); List> initialUserScripts = (List>) b.getSerializable("initialUserScripts"); - options = new InAppBrowserOptions(); - options.parse(optionsMap); - InAppWebViewOptions webViewOptions = new InAppWebViewOptions(); webViewOptions.parse(optionsMap); webView.options = webViewOptions; diff --git a/pubspec.yaml b/pubspec.yaml index 4817ab3d..270474e4 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_inappwebview description: A Flutter plugin that allows you to add an inline webview, to use an headless webview, and to open an in-app browser window. -version: 5.4.3+1 +version: 5.4.3+2 homepage: https://github.com/pichillilorenzo/flutter_inappwebview environment: