From 00fb114bce53c764b4b8135a8bc4fface3ba5102 Mon Sep 17 00:00:00 2001 From: Burkov Egor Date: Mon, 23 Jun 2025 18:14:30 +0300 Subject: [PATCH] fix: add checks for nil HTTP in admin-trace matches func (#5216) --- cmd/admin-trace.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cmd/admin-trace.go b/cmd/admin-trace.go index cb733a99..febb0e02 100644 --- a/cmd/admin-trace.go +++ b/cmd/admin-trace.go @@ -411,12 +411,10 @@ func (opts matchOpts) matches(traceInfo madmin.ServiceTraceInfo) bool { } } - if opts.requestSize > 0 && traceInfo.Trace.HTTP.CallStats.InputBytes < int(opts.requestSize) { - return false - } - - if opts.responseSize > 0 && traceInfo.Trace.HTTP.CallStats.OutputBytes < int(opts.responseSize) { - return false + if traceInfo.Trace.HTTP != nil { + if (opts.requestSize > 0 && traceInfo.Trace.HTTP.CallStats.InputBytes < int(opts.requestSize)) || (opts.responseSize > 0 && traceInfo.Trace.HTTP.CallStats.OutputBytes < int(opts.responseSize)) { + return false + } } return true