From 686d013734d69b82631703f28fa687b8520ac49a Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 15 Apr 2022 17:31:53 -0700 Subject: [PATCH] fix(windows): reintroduce hwnd val checks @riverar pointed out on Discord that I had my if and else clauses here mixed up. This commit reintroduces null value checks for HWNDs returned from Windows API calls. --- komorebi/src/windows_api.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/komorebi/src/windows_api.rs b/komorebi/src/windows_api.rs index b18277c7..5e8756f1 100644 --- a/komorebi/src/windows_api.rs +++ b/komorebi/src/windows_api.rs @@ -130,7 +130,11 @@ macro_rules! impl_process_windows_crate_integer_wrapper_result { $( impl ProcessWindowsCrateResult<$deref> for $input { fn process(self) -> Result<$deref> { - Ok(self.0) + if self == HWND(0) { + Err(std::io::Error::last_os_error().into()) + } else { + Ok(self.0) + } } } )+