aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-01 02:59:59 +0000
committerBlaž Hrastnik2021-06-01 02:59:59 +0000
commitd8e16554bf0478e30853e8950132a2d17dba5a17 (patch)
tree6cc2d9a0193a310b1e1f28bb56d55cdb8ea3931b /helix-term/src
parent2cc30cd07c8974e10423757899ac368cce3e3294 (diff)
Don't crash if no filename specified on open
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 69e335dc..c1a07d68 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -885,8 +885,15 @@ mod cmd {
}
fn open(editor: &mut Editor, args: &[&str], event: PromptEvent) {
- let path = args[0];
- editor.open(path.into(), Action::Replace);
+ match args.get(0) {
+ Some(path) => {
+ // TODO: handle error
+ editor.open(path.into(), Action::Replace);
+ }
+ None => {
+ editor.set_error("wrong argument count".to_string());
+ }
+ };
}
fn write(editor: &mut Editor, args: &[&str], event: PromptEvent) {