From e5e9b5dc08fd49356019e56095f88b90dc74e672 Mon Sep 17 00:00:00 2001 From: Bruno-Vdr Date: Sun, 23 Feb 2025 20:02:47 +0100 Subject: [PATCH] v.pref: fix panic in parse_args_and_show_errors, called with no args (fix #23713) (#23794) --- vlib/v/pref/pref.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index afa6cc4e2b742a..3b6d10d8499c64 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -104,7 +104,7 @@ pub mut: is_liveshared bool // a shared library, that will be used in a -live main program is_shared bool // an ordinary shared library, -shared, no matter if it is live or not is_o bool // building an .o file - is_prof bool // benchmark every function + is_prof bool // benchmark every function is_prod bool // use "-O3" no_prod_options bool // `-no-prod-options`, means do not pass any optimization flags to the C compilation, while still allowing the user to use for example `-cflags -Os` to pass custom ones is_repl bool @@ -1079,7 +1079,7 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin run_code_in_tmp_vfile_and_exit(args, mut res, '-e', 'vsh', res.eval_argument) } - command_args := args[command_idx + 1..] + command_args := args#[command_idx + 1..] if res.is_run || res.is_crun { res.path = command_args[0] or { eprintln_exit('v run: no v files listed') } res.run_args = command_args[1..]