aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorThanabodee Charoenpiriyakij2021-11-25 02:02:51 +0000
committerGitHub2021-11-25 02:02:51 +0000
commite8f800a141af11b4f2f4c838cd4fd1f8aa7fa971 (patch)
treece07929a5418a5a34e7f2d0ed20a7936f8751a30 /helix-term/src
parent95f392b18db27117b26c4be732a4298353bdc27e (diff)
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
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs4
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));