Commit 07f63a5f authored by Lorenzo Pichilli's avatar Lorenzo Pichilli Committed by GitHub

Merge pull request #116 from robsonfingo/master

Avoid null pointer exception after webview is disposed
parents d7edfc5e 8590e919
......@@ -51,6 +51,10 @@ public class JavaScriptBridgeInterface {
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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment