pref: fix access in invalid position on `v search ''` (#13993)
parent
473bc0254d
commit
3571f66a82
|
@ -634,7 +634,7 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin
|
||||||
eprintln('Use `v $arg` instead.')
|
eprintln('Use `v $arg` instead.')
|
||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
if arg[0] == `-` {
|
if arg.len != 0 && arg[0] == `-` {
|
||||||
if arg[1..] in pref.list_of_flags_with_param {
|
if arg[1..] in pref.list_of_flags_with_param {
|
||||||
// skip parameter
|
// skip parameter
|
||||||
i++
|
i++
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
module pref
|
||||||
|
|
||||||
|
fn test_check_parametes() {
|
||||||
|
// reproducing issue https://github.com/vlang/v/issues/13983
|
||||||
|
_, cmd := parse_args_and_show_errors(['help'], [''], true)
|
||||||
|
// no command found from args
|
||||||
|
assert cmd == ''
|
||||||
|
}
|
Loading…
Reference in New Issue