From a0e3bc2de77998b2058a8ed4eb4f93e65b23d454 Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Fri, 26 Mar 2021 21:34:42 +0100 Subject: [PATCH] fix #757 --- CHANGELOG.md | 1 + .../InAppWebViewRenderProcessClient.java | 36 ++++++++++--------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d925a7a..9fc0c445 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - `getScale` WebView method is now deprecated. Use the new `getZoomScale` WebView method - Removed `final` keyword for all `HeadlessInAppWebView` events - Fixed wrong usage of Android WebView scale property +- Fixed "java.lang.NullPointerException: com.pichillilorenzo.flutter_inappwebview.in_app_webview.InAppWebViewRenderProcessClient$1.success(InAppWebViewRenderProcessClient.java:37)" [#757](https://github.com/pichillilorenzo/flutter_inappwebview/issues/757) ## 5.2.1+1 diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebViewRenderProcessClient.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebViewRenderProcessClient.java index 59a30cff..b3d96c9b 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebViewRenderProcessClient.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebViewRenderProcessClient.java @@ -33,14 +33,16 @@ public class InAppWebViewRenderProcessClient extends WebViewRenderProcessClient @Override public void success(@Nullable Object response) { - Map responseMap = (Map) response; - Integer action = (Integer) responseMap.get("action"); - if (action != null && renderer != null) { - switch (action) { - case 0: - if (WebViewFeature.isFeatureSupported(WebViewFeature.WEB_VIEW_RENDERER_TERMINATE)) - renderer.terminate(); - break; + if (response != null) { + Map responseMap = (Map) response; + Integer action = (Integer) responseMap.get("action"); + if (action != null && renderer != null) { + switch (action) { + case 0: + if (WebViewFeature.isFeatureSupported(WebViewFeature.WEB_VIEW_RENDERER_TERMINATE)) + renderer.terminate(); + break; + } } } } @@ -65,14 +67,16 @@ public class InAppWebViewRenderProcessClient extends WebViewRenderProcessClient @Override public void success(@Nullable Object response) { - Map responseMap = (Map) response; - Integer action = (Integer) responseMap.get("action"); - if (action != null && renderer != null) { - switch (action) { - case 0: - if (WebViewFeature.isFeatureSupported(WebViewFeature.WEB_VIEW_RENDERER_TERMINATE)) - renderer.terminate(); - break; + if (response != null) { + Map responseMap = (Map) response; + Integer action = (Integer) responseMap.get("action"); + if (action != null && renderer != null) { + switch (action) { + case 0: + if (WebViewFeature.isFeatureSupported(WebViewFeature.WEB_VIEW_RENDERER_TERMINATE)) + renderer.terminate(); + break; + } } } }