Browse Source

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

Roc 5 years ago
parent
commit
12db6956a9

+ 3
- 0
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java View File

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