Fix validate that string is not empty before strconv.ParseFloat (#59)
Thanks. I could have sworn I went through already and done this at one point in time, but I guess not.
This commit is contained in:
committed by
Steve Brunton
parent
5cccba9e17
commit
9ceb56fdbf
@@ -32,7 +32,9 @@ func description(prefix, name, helpText string, labelNames []string) *prometheus
|
||||
|
||||
func splitStringToFloats(metric string) (float64, float64, error) {
|
||||
strs := strings.Split(metric, ",")
|
||||
|
||||
if len(strs) == 0 {
|
||||
return 0, 0, nil
|
||||
}
|
||||
m1, err := strconv.ParseFloat(strs[0], 64)
|
||||
if err != nil {
|
||||
return math.NaN(), math.NaN(), err
|
||||
|
||||
Reference in New Issue
Block a user