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

cmd/v: handle wrong type of flags

This commit is contained in:
Delyan Angelov 2020-03-07 15:15:23 +02:00 committed by GitHub
parent 5827ff0a01
commit 88c1ff91ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,6 +72,9 @@ pub fn (p mut Instance) int() ?int {
val := p.string() or { val := p.string() or {
return error(err) return error(err)
} }
if !val[0].is_digit() {
return error('an integer number was expected, but "$val" was found instead.')
}
return val.int() return val.int()
} }