Skip to content

Commit

Permalink
Merge pull request #491 from bookingcom/dzhdanov/absent-panic-fix
Browse files Browse the repository at this point in the history
Checking absent array size during marshaling
  • Loading branch information
deniszh authored Jun 22, 2023
2 parents c15bce2 + 908d470 commit 73996ff
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 73996ff

Please sign in to comment.