diff --git a/codex-rs/tui/src/terminal_palette.rs b/codex-rs/tui/src/terminal_palette.rs index 7550ee0f99..fcd5398231 100644 --- a/codex-rs/tui/src/terminal_palette.rs +++ b/codex-rs/tui/src/terminal_palette.rs @@ -596,7 +596,9 @@ mod imp { fn query_console_snapshot() -> Option { unsafe { let handle = GetStdHandle(STD_OUTPUT_HANDLE); - if handle.is_null() || handle == INVALID_HANDLE_VALUE { + // `HANDLE` is an `isize`, so compare against 0 explicitly instead of treating + // it like a raw pointer when verifying the console handle succeeded. + if handle == 0 || handle == INVALID_HANDLE_VALUE { return None; }