From 578c69476d8bc5fca26c7e4ab692d3ca373e84af Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Fri, 17 Mar 2023 10:56:44 -0700 Subject: [PATCH] Align dispatch_keystroke with other uses of ancestors iterator and filter out non-existant views --- crates/gpui/src/app.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index b4d88a7270..d476ecdef9 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -1479,15 +1479,11 @@ impl MutableAppContext { if let Some(focused_view_id) = self.focused_view_id(window_id) { let dispatch_path = self .ancestors(window_id, focused_view_id) - .map(|view_id| { - ( - view_id, - self.cx - .views - .get(&(window_id, view_id)) - .unwrap() - .keymap_context(self.as_ref()), - ) + .filter_map(|view_id| { + self.cx + .views + .get(&(window_id, view_id)) + .map(|view| (view_id, view.keymap_context(self.as_ref()))) }) .collect();