Skip to content

Commit

Permalink
fix(macos): check IPC message body is null before deference it (#1267)
Browse files Browse the repository at this point in the history
  • Loading branch information
pewsheen committed May 16, 2024
1 parent 1098ca9 commit 1e65049
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/fix-macos-ipc-empty-body-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

On macOS, fixed a crash when sending empty body by IPC.
4 changes: 3 additions & 1 deletion src/wkwebview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ impl InnerWebView {
if !body.is_null() {
let length = msg_send![body, length];
let data_bytes: id = msg_send![body, bytes];
sent_form_body = slice::from_raw_parts(data_bytes as *const u8, length).to_vec();
if !data_bytes.is_null() {
sent_form_body = slice::from_raw_parts(data_bytes as *const u8, length).to_vec();
}
} else if !body_stream.is_null() {
let _: () = msg_send![body_stream, open];

Expand Down

0 comments on commit 1e65049

Please sign in to comment.