From 908d470660fe13be98f60157a41c766f1725935f Mon Sep 17 00:00:00 2001 From: Denys Zhdanov Date: Tue, 30 May 2023 16:46:21 +0200 Subject: [PATCH] Checking absent array size during marshaling --- pkg/expr/types/types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/expr/types/types.go b/pkg/expr/types/types.go index cc0d756f..6e900c58 100644 --- a/pkg/expr/types/types.go +++ b/pkg/expr/types/types.go @@ -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)