1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

flag: fix panic on single -

This commit is contained in:
Marcin
2020-09-24 14:50:44 +02:00
committed by GitHub
parent 72ecc222ee
commit fb45e2e046
2 changed files with 9 additions and 1 deletions

View File

@@ -176,7 +176,7 @@ fn (mut fs FlagParser) parse_bool_value(longhand string, shorthand byte) ?string
fs.args.delete(i)
return val
}
if arg[0] == `-` && arg[1] != `-` && arg.index_byte(shorthand) != -1 {
if arg.len > 1 && arg[0] == `-` && arg[1] != `-` && arg.index_byte(shorthand) != -1 {
// -abc is equivalent to -a -b -c
return 'true'
}