Skip to content

Commit

Permalink
fix(android): null pointer exception on ipc.postMessage(null) (#1180)
Browse files Browse the repository at this point in the history
* fix(android): null pointer exception on ipc.postMessage(null)

* typo
  • Loading branch information
lucasfernog authored Mar 4, 2024
1 parent f8761fb commit e6f0fbd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/android-ipc-ignore-null-message.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Fixes a null pointer exception when running `window.ipc.postMessage(null)` on Android.
6 changes: 4 additions & 2 deletions src/android/kotlin/Ipc.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import android.webkit.*

class Ipc {
@JavascriptInterface
fun postMessage(message: String) {
this.ipc(message)
fun postMessage(message: String?) {
message?.let {m ->
this.ipc(m)
}
}

companion object {
Expand Down

0 comments on commit e6f0fbd

Please sign in to comment.