From 96429c10a106a725e1696cb466a9ab8851bc0e5b Mon Sep 17 00:00:00 2001 From: df-wg Date: Mon, 14 Oct 2024 21:42:48 +0300 Subject: [PATCH] fix: Ensure that nil http responses don't cause issues (#3329) --- graphql/handler/debug/tracer.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/graphql/handler/debug/tracer.go b/graphql/handler/debug/tracer.go index 830faa7d4cc..1fc574e39b6 100644 --- a/graphql/handler/debug/tracer.go +++ b/graphql/handler/debug/tracer.go @@ -61,9 +61,12 @@ func (a Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHand resp := next(ctx) _, _ = fmt.Fprintln(a.out, " resp:", aurora.Green(stringify(resp))) - for _, err := range resp.Errors { - _, _ = fmt.Fprintln(a.out, " error:", aurora.Bold(err.Path.String()+":"), aurora.Red(err.Message)) + if resp != nil { + for _, err := range resp.Errors { + _, _ = fmt.Fprintln(a.out, " error:", aurora.Bold(err.Path.String()+":"), aurora.Red(err.Message)) + } } + _, _ = fmt.Fprintln(a.out, "}") _, _ = fmt.Fprintln(a.out) return resp