on master help sign in
Do not crash when run goto command without line number (#1160)
e8f800aThanabodee Charoenpiriyakij
helix-term/src/commands.rs+4
@@ -2485,6 +2485,10 @@ mod cmd {
2485 args: &[&str],
2485 args: &[&str],
2486 _event: PromptEvent,
2486 _event: PromptEvent,
2487 ) -> anyhow::Result<()> {
2487 ) -> anyhow::Result<()> {
2488+ if args.is_empty() {
2489+ bail!("Line number required");
2490+ }
2491+
2488 let line = args[0].parse::<usize>()?;
2492 let line = args[0].parse::<usize>()?;
2489
2493
2490 goto_line_impl(&mut cx.editor, NonZeroUsize::new(line));
2494 goto_line_impl(&mut cx.editor, NonZeroUsize::new(line));