Skip to content

Commit 41088ef

Browse files
committed
fix(single-instance): Check if pointer is null
fixes #2405
1 parent c10d5bf commit 41088ef

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
single-instance: patch
3+
single-instance-js: patch
4+
---
5+
6+
Fixed an issue that caused `null pointer dereference occurred` errors on rust nightly.

plugins/process/permissions/schemas/schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,4 +322,4 @@
322322
]
323323
}
324324
}
325-
}
325+
}

plugins/single-instance/src/platform_impl/windows.rs

+5
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ unsafe extern "system" fn single_instance_window_proc<R: Runtime>(
118118
) -> LRESULT {
119119
let data_ptr = GetWindowLongPtrW(hwnd, GWL_USERDATA)
120120
as *mut (AppHandle<R>, Box<SingleInstanceCallback<R>>);
121+
122+
if data_ptr.is_null() {
123+
return DefWindowProcW(hwnd, msg, wparam, lparam);
124+
}
125+
121126
let (app_handle, callback) = &mut *data_ptr;
122127

123128
match msg {

0 commit comments

Comments
 (0)