From 1c4bb60209950770debdb23a7a63c899d069d3ef Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Tue, 11 Nov 2025 11:55:19 +0100 Subject: [PATCH] gpui: Fix invalid unwrap in windows window creation (#42426) Fixes ZED-34M Release Notes: - N/A *or* Added/Fixed/Improved ... --- crates/gpui/src/platform/windows/window.rs | 3 ++- crates/project/src/lsp_store.rs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rs index a9217a85e3e38697fbb06aea3067901d222e3986..0050fa4bc0e96b8702314f33637db67998b5941d 100644 --- a/crates/gpui/src/platform/windows/window.rs +++ b/crates/gpui/src/platform/windows/window.rs @@ -453,8 +453,9 @@ impl WindowsWindow { // Failure to create a `WindowsWindowState` can cause window creation to fail, // so check the inner result first. - let this = context.inner.take().unwrap()?; + let this = context.inner.take().transpose()?; let hwnd = creation_result?; + let this = this.unwrap(); register_drag_drop(&this)?; configure_dwm_dark_mode(hwnd, appearance); diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index ecfe169b47b7daa1b1c8c0794d9cdde8f0b06ad4..90675e364b4d962b5c67cafb941b2b6cb9e1df9b 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -7651,7 +7651,10 @@ impl LspStore { let buffer = buffer.read(cx); let file = File::from_dyn(buffer.file())?; let abs_path = file.as_local()?.abs_path(cx); - let uri = lsp::Uri::from_file_path(abs_path).unwrap(); + let uri = lsp::Uri::from_file_path(&abs_path) + .ok() + .with_context(|| format!("Failed to convert path to URI: {}", abs_path.display())) + .unwrap(); let next_snapshot = buffer.text_snapshot(); for language_server in language_servers { let language_server = language_server.clone();