浏览代码

fix(android): add null reference check for onMessage on android (#770)

Roc 5 年前
父节点
当前提交
12db6956a9
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3
    0
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java

+ 3
- 0
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java 查看文件

@@ -994,6 +994,9 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
994 994
         webView.post(new Runnable() {
995 995
           @Override
996 996
           public void run() {
997
+            if (mRNCWebViewClient == null) {
998
+              return;
999
+            }
997 1000
             WritableMap data = mRNCWebViewClient.createWebViewEvent(webView, webView.getUrl());
998 1001
             data.putString("data", message);
999 1002
             dispatchEvent(webView, new TopMessageEvent(webView.getId(), data));