mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-19 13:37:06 +04:00
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
This commit is contained in:
parent
95f392b18d
commit
e8f800a141
@ -2485,6 +2485,10 @@ pub(super) fn goto_line_number(
|
||||
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…
Reference in New Issue
Block a user