fix(single-instance): check if pointer is null (#2452)

This commit is contained in:
Fabian-Lars
2025-02-23 18:25:00 +01:00
committed by GitHub
parent c10d5bfb54
commit 1ab5f15763
3 changed files with 11 additions and 1 deletions
@@ -0,0 +1,5 @@
---
single-instance: patch
---
Fixed an issue that caused `null pointer dereference occurred` errors on rust nightly.
@@ -322,4 +322,4 @@
]
}
}
}
}
@@ -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 {