fix(single-instance): Check if pointer is null

fixes #2405
pull/2452/head
FabianLars 5 months ago
parent c10d5bfb54
commit 41088ef0cb
No known key found for this signature in database

@ -0,0 +1,6 @@
---
single-instance: patch
single-instance-js: patch
---
Fixed an issue that caused `null pointer dereference occurred` errors on rust nightly.

@ -118,6 +118,11 @@ unsafe extern "system" fn single_instance_window_proc<R: Runtime>(
) -> LRESULT {
let data_ptr = GetWindowLongPtrW(hwnd, GWL_USERDATA)
as *mut (AppHandle<R>, Box<SingleInstanceCallback<R>>);
if data_ptr.is_null() {
return DefWindowProcW(hwnd, msg, wparam, lparam);
}
let (app_handle, callback) = &mut *data_ptr;
match msg {

Loading…
Cancel
Save