From c05ca63158cfb8b0f94d714fe3c69d4ff721dd83 Mon Sep 17 00:00:00 2001 From: Shireesh Anjal <355479+anjalshireesh@users.noreply.github.com> Date: Wed, 15 May 2024 21:36:35 +0530 Subject: [PATCH] Fix crash on /minio/metrics/v3?list (#19745) An unchecked map access was causing panic. --- cmd/metrics-v3-handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/metrics-v3-handler.go b/cmd/metrics-v3-handler.go index b7c8c2ba4..24dcf838f 100644 --- a/cmd/metrics-v3-handler.go +++ b/cmd/metrics-v3-handler.go @@ -105,8 +105,8 @@ func (h *metricsV3Server) listMetrics(path string) http.Handler { if collPath.isDescendantOf(path) { if v, ok := h.metricsData.mgMap[collPath]; ok { matchingMG[collPath] = v - } else { - matchingMG[collPath] = h.metricsData.bucketMGMap[collPath] + } else if v, ok := h.metricsData.bucketMGMap[collPath]; ok { + matchingMG[collPath] = v } } }