fix(properties): parse int64 correctly

resolves #2334
This commit is contained in:
Jan De Dobbeleer 2022-05-27 10:23:09 +02:00 committed by Jan De Dobbeleer
parent 2ea6198a13
commit e41304ae44

View file

@ -116,17 +116,20 @@ func (m Map) GetInt(property Property, defaultValue int) int {
return defaultValue
}
if intValue, ok := val.(int); ok {
return intValue
}
// config parser parses a float
switch v := val.(type) {
case int:
return v
case int64:
return int(v)
case float64:
intValue, ok := val.(float64)
if !ok {
return defaultValue
}
return int(intValue)
default:
return defaultValue
}
}
func (m Map) GetKeyValueMap(property Property, defaultValue map[string]string) map[string]string {