Fix crash if pressing enter when nothing selected in completion.

pull/11/head
Blaž Hrastnik 4 years ago
parent 8657c57cf2
commit 350081a3af

@ -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 {

Loading…
Cancel
Save