From 1add3569399bc68cfec2accd7e7e2e8cce8195dc Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Sat, 3 Aug 2024 13:50:51 +1000 Subject: [PATCH] Fix windows.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --- crates/detect-targets/src/detect/windows.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/detect-targets/src/detect/windows.rs b/crates/detect-targets/src/detect/windows.rs index 5e4fe447..625d16e7 100644 --- a/crates/detect-targets/src/detect/windows.rs +++ b/crates/detect-targets/src/detect/windows.rs @@ -1,4 +1,4 @@ -use std::mem; +use std::{mem, ptr}; use windows_sys::Win32::{ Foundation::{FreeLibrary, HMODULE, S_OK}, System::{ @@ -16,7 +16,7 @@ struct LibraryHandle(HMODULE); impl LibraryHandle { fn new(name: &[u8]) -> Option { let handle = unsafe { LoadLibraryA(name.as_ptr() as _) }; - (handle != 0).then(|| Self(handle)) + (handle != ptr::null_mut()).then(|| Self(handle)) } /// Get a function pointer to a function in the library.