From c31f9cf23a7335b04ee98cd3671d12bf5834e02a Mon Sep 17 00:00:00 2001 From: Delweng Date: Wed, 23 Aug 2023 15:47:42 +0800 Subject: [PATCH] graphql: fix nil deref on a timer (#27978) graphql: fix the panic of nil timer.Stop Signed-off-by: jsvisa --- graphql/service.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/graphql/service.go b/graphql/service.go index 4ca427658a..f33e763058 100644 --- a/graphql/service.go +++ b/graphql/service.go @@ -88,7 +88,9 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } response := h.Schema.Exec(ctx, params.Query, params.OperationName, params.Variables) - timer.Stop() + if timer != nil { + timer.Stop() + } responded.Do(func() { responseJSON, err := json.Marshal(response) if err != nil {