From 5e5f209f79e7243b45ca978e65ccfc103daee01e Mon Sep 17 00:00:00 2001 From: AndrewChubatiuk Date: Mon, 20 May 2024 15:46:52 +0300 Subject: [PATCH] histograms: fixed panic in merge when target bucket is nil --- histogram.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/histogram.go b/histogram.go index 26d93a7..0d953d5 100644 --- a/histogram.go +++ b/histogram.go @@ -125,6 +125,10 @@ func (h *Histogram) Merge(b *Histogram) { if db == nil { continue } + if h.decimalBuckets[i] == nil { + var b [bucketsPerDecimal]uint64 + h.decimalBuckets[i] = &b + } for j := range db { h.decimalBuckets[i][j] = db[j] }