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
pull/1165/head
Thanabodee Charoenpiriyakij 3 years ago committed by GitHub
parent 95f392b18d
commit e8f800a141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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));

Loading…
Cancel
Save