From 2788d8e28cd6da50f003da07434f6c8bdb776fc7 Mon Sep 17 00:00:00 2001 From: Jim Speth Date: Thu, 14 Feb 2019 11:50:57 -0500 Subject: [PATCH] Prevent crash if node handle for webview cannot be found. --- WKWebView.ios.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/WKWebView.ios.js b/WKWebView.ios.js index a24024a2..2ace9d7a 100644 --- a/WKWebView.ios.js +++ b/WKWebView.ios.js @@ -449,8 +449,13 @@ class WKWebView extends React.Component { * ``` */ postMessage = (data) => { + const webViewHandle = this.getWebViewHandle(); + if (webViewHandle === null) { + console.warn('CRAWKWebView postMessage: skipping message. No node handle for webview.'); + return; + } UIManager.dispatchViewManagerCommand( - this.getWebViewHandle(), + webViewHandle, UIManager.CRAWKWebView.Commands.postMessage, [String(data)] );