Skip to content

Commit

Permalink
Do not crash when run goto command without line number
Browse files Browse the repository at this point in the history
Report an error when running goto command without entering a
line number.

Fixes #1159
  • Loading branch information
wingyplus committed Nov 24, 2021
1 parent 1eecd9a commit 1dcfe47
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2485,6 +2485,10 @@ mod cmd {
args: &[&str],
_event: PromptEvent,
) -> anyhow::Result<()> {
if args.len() == 0 {
bail!("Line number required");
}

let line = args[0].parse::<usize>()?;

goto_line_impl(&mut cx.editor, NonZeroUsize::new(line));
Expand Down

0 comments on commit 1dcfe47

Please sign in to comment.