Skip to content
This repository was archived by the owner on Nov 27, 2025. It is now read-only.

Commit 4baf51c

Browse files
ajkshfjkajmaikai (A)
andauthored
fix: 修复postMessage导致的闪退 (#146)
Co-authored-by: maikai (A) <[email protected]>
1 parent aa897f3 commit 4baf51c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

harmony/rn_webview/src/main/ets/RNCWebView.ets

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,11 @@ export struct RNCWebView {
566566
Logger.debug(TAG, `[RNOH] bridge postMessage, ${JSON.stringify(data)}`);
567567
if (this.controller != null) {
568568
let result: WebViewEventParams = this.createWebViewEvent("onMessage")
569-
result.data = data.toString()
570-
result.lockIdentifier = ZERO
571-
this.eventEmitter!.emit("message", result as ResultType);
569+
if (result) {
570+
result.data = data.toString()
571+
result.lockIdentifier = ZERO
572+
this.eventEmitter!.emit("message", result as ResultType);
573+
}
572574
}
573575
}
574576
};

0 commit comments

Comments
 (0)