Skip to content

Commit

Permalink
Checking absent array size during marshaling
Browse files Browse the repository at this point in the history
  • Loading branch information
deniszh committed May 30, 2023
1 parent b48f416 commit 908d470
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/expr/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func MarshalJSON(results []*MetricData) []byte {

b = append(b, '[')

if absent[i] || math.IsInf(v, 0) || math.IsNaN(v) {
if (i < len(absent) && absent[i]) || math.IsInf(v, 0) || math.IsNaN(v) {
b = append(b, "null"...)
} else {
b = strconv.AppendFloat(b, v, 'f', -1, 64)
Expand Down

0 comments on commit 908d470

Please sign in to comment.