mirror of https://github.com/helix-editor/helix
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 zeropull/1165/head
parent
95f392b18d
commit
e8f800a141
|
@ -2485,6 +2485,10 @@ mod cmd {
|
||||||
args: &[&str],
|
args: &[&str],
|
||||||
_event: PromptEvent,
|
_event: PromptEvent,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
|
if args.is_empty() {
|
||||||
|
bail!("Line number required");
|
||||||
|
}
|
||||||
|
|
||||||
let line = args[0].parse::<usize>()?;
|
let line = args[0].parse::<usize>()?;
|
||||||
|
|
||||||
goto_line_impl(&mut cx.editor, NonZeroUsize::new(line));
|
goto_line_impl(&mut cx.editor, NonZeroUsize::new(line));
|
||||||
|
|
Loading…
Reference in New Issue