diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index e98935886..049d6170b 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -140,7 +140,9 @@ impl Component for Menu { code: KeyCode::Enter, .. } => { - (self.callback_fn)(cx.editor, self.selection(), MenuEvent::Validate); + if let Some(selection) = self.selection() { + (self.callback_fn)(cx.editor, Some(selection), MenuEvent::Validate); + } return close_fn; } // KeyEvent {