Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui: Avoid dereferencing null pointer in `MacWindow::active_window` (#28059)
Marshall Bowersec40e2d85c08
diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rsindex e655e067f88..936b6df48a4 100644--- a/crates/gpui/src/platform/mac/window.rs+++ b/crates/gpui/src/platform/mac/window.rs@@ -744,6 +744,10 @@ impl MacWindow {unsafe {let app = NSApplication::sharedApplication(nil);let main_window: id = msg_send![app, mainWindow];+ if main_window.is_null() {+ return None;+ }+if msg_send![main_window, isKindOfClass: WINDOW_CLASS] {let handle = get_window_state(&*main_window).lock().handle;Some(handle)