flag: fix array boundary check

pull/3938/head
Alexander Medvednikov 2020-03-06 02:02:32 +01:00 committed by GitHub
parent efb45579aa
commit 7a92a47eb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -156,7 +156,7 @@ fn (fs mut FlagParser) parse_value(longhand string, shorthand byte) []string {
continue
}
if (arg.len == 2 && arg[0] == `-` && arg[1] == shorthand ) || arg == full {
if i+1 > fs.args.len {
if i+1 >= fs.args.len {
panic("Missing argument for '$longhand'")
}
nextarg := fs.args[i+1]