From 5216ddbcfc132639b111c1ee1891243f9ece7561 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Fri, 10 May 2024 10:53:39 +0800 Subject: [PATCH] infoschema: fix the nil pointer (#53096) (#53148) close pingcap/tidb#52842 --- pkg/infoschema/tables.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/infoschema/tables.go b/pkg/infoschema/tables.go index 1f8e33a83f639..3576e87c217cf 100644 --- a/pkg/infoschema/tables.go +++ b/pkg/infoschema/tables.go @@ -1988,15 +1988,15 @@ func getMicroServiceServerInfo(ctx sessionctx.Context, serviceName string) ([]Se } req.Header.Add("PD-Allow-follower-handle", "true") resp, err := util.InternalHTTPClient().Do(req) - if resp == nil || resp.StatusCode != http.StatusOK { - terror.Log(resp.Body.Close()) - continue - } if err != nil { ctx.GetSessionVars().StmtCtx.AppendWarning(err) logutil.BgLogger().Warn("request microservice server info error", zap.String("service", serviceName), zap.String("url", url), zap.Error(err)) continue } + if resp.StatusCode != http.StatusOK { + terror.Log(resp.Body.Close()) + continue + } var content = []struct { ServiceAddr string `json:"service-addr"` Version string `json:"version"`