From 69a5c45672fa599f1a5239a942724231fa36a427 Mon Sep 17 00:00:00 2001 From: James Tucker Date: Wed, 3 Sep 2025 23:18:23 -0700 Subject: [PATCH] gpui: Fix out-of-bounds node indices in dispatch_path (#37252) Observed in a somewhat regular startup crash on Windows at head (~50% of launches in release mode). Closes #37212 Release Notes: - N/A --- crates/gpui/src/key_dispatch.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/gpui/src/key_dispatch.rs b/crates/gpui/src/key_dispatch.rs index 95374e579fa5cc11d84c2ba7e9ec88f261d8d2b2..63cfa680c0d158811a92cddfda390ff82fb7db5c 100644 --- a/crates/gpui/src/key_dispatch.rs +++ b/crates/gpui/src/key_dispatch.rs @@ -552,7 +552,7 @@ impl DispatchTree { let mut current_node_id = Some(target); while let Some(node_id) = current_node_id { dispatch_path.push(node_id); - current_node_id = self.nodes[node_id.0].parent; + current_node_id = self.nodes.get(node_id.0).and_then(|node| node.parent); } dispatch_path.reverse(); // Reverse the path so it goes from the root to the focused node. dispatch_path