Fix empty command cause panic

pull/40/head
Daichi Takamiya 4 years ago
parent dbc392d92c
commit 4d12c7c3cf

@ -1031,6 +1031,9 @@ pub fn command_mode(cx: &mut Context) {
} }
let parts = input.split_ascii_whitespace().collect::<Vec<&str>>(); let parts = input.split_ascii_whitespace().collect::<Vec<&str>>();
if parts.is_empty() {
return;
}
if let Some(cmd) = cmd::COMMANDS.get(parts[0]) { if let Some(cmd) = cmd::COMMANDS.get(parts[0]) {
(cmd.fun)(editor, &parts[1..], event); (cmd.fun)(editor, &parts[1..], event);

Loading…
Cancel
Save