Unnamed repository; edit this file 'description' to name the repository.
Do not crash when run goto command without line number (#1160)
* Do not crash when run goto command without line number
Report an error when running goto command without entering a
line number.
Fixes #1159
* Use is_empty() instead check len zero
| -rw-r--r-- | helix-term/src/commands.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index b5b6ac6d..ff8d7a4f 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2485,6 +2485,10 @@ mod cmd { args: &[&str], _event: PromptEvent, ) -> anyhow::Result<()> { + if args.is_empty() { + bail!("Line number required"); + } + let line = args[0].parse::<usize>()?; goto_line_impl(&mut cx.editor, NonZeroUsize::new(line)); |