diff options
author | Blaž Hrastnik | 2021-03-24 09:15:42 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-03-24 09:15:42 +0000 |
commit | 350081a3af9a4cd87f177289d54feb8861b1313e (patch) | |
tree | 471f5b0d9b1ea45d3fecd0053fe53db276c44c9e /helix-term | |
parent | 8657c57cf2d56b9a89e2f780675426f4c78df48b (diff) |
Fix crash if pressing enter when nothing selected in completion.
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/ui/menu.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index e9893588..049d6170 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -140,7 +140,9 @@ impl<T> Component for Menu<T> { 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 { |