diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/JavaScriptBridgeInterface.java b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/JavaScriptBridgeInterface.java index 9f404803c..415fb134e 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/JavaScriptBridgeInterface.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/JavaScriptBridgeInterface.java @@ -51,6 +51,10 @@ public void run() { getChannel().invokeMethod("onCallJsHandler", obj, new MethodChannel.Result() { @Override public void success(Object json) { + if (flutterWebView.webView == null) { + // The webview has already been disposed, ignore. + return; + } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { flutterWebView.webView.evaluateJavascript("window." + name + "[" + _callHandlerID + "](" + json + "); delete window." + name + "[" + _callHandlerID + "];", null); }