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

pull/2453/head
Fabian-Lars 3 months ago committed by GitHub
parent c10d5bfb54
commit 1ab5f15763
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
single-instance: 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