histograms: fixed panic in merge when target bucket is nil

This commit is contained in:
AndrewChubatiuk 2024-05-20 15:46:52 +03:00
parent a52bdc6f15
commit 5e5f209f79
No known key found for this signature in database
GPG Key ID: 96D776CC99880667

View File

@ -125,6 +125,10 @@ func (h *Histogram) Merge(b *Histogram) {
if db == nil { if db == nil {
continue continue
} }
if h.decimalBuckets[i] == nil {
var b [bucketsPerDecimal]uint64
h.decimalBuckets[i] = &b
}
for j := range db { for j := range db {
h.decimalBuckets[i][j] = db[j] h.decimalBuckets[i][j] = db[j]
} }