mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
pref: fix access in invalid position on v search ''
(#13993)
This commit is contained in:
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++
|
||||||
|
8
vlib/v/pref/pref_test.v
Normal file
8
vlib/v/pref/pref_test.v
Normal file
@ -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…
x
Reference in New Issue
Block a user