From 04d257ce62abba03d6e8657d51dbeedbfe969dca Mon Sep 17 00:00:00 2001 From: Nick Clark Date: Wed, 16 Aug 2023 08:46:37 +1000 Subject: [PATCH] prevent a nil deref when client gets a nil response from an unavailable cluster --- internal/clients/kibana/slo.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/clients/kibana/slo.go b/internal/clients/kibana/slo.go index 29110d1b6..9a4f24a6e 100644 --- a/internal/clients/kibana/slo.go +++ b/internal/clients/kibana/slo.go @@ -21,6 +21,9 @@ func GetSlo(ctx context.Context, apiClient *clients.ApiClient, id, spaceID strin ctxWithAuth := apiClient.SetSloAuthContext(ctx) req := client.GetSloOp(ctxWithAuth, "default", id).KbnXsrf("true") sloRes, res, err := req.Execute() + if err != nil && res == nil { + return nil, diag.FromErr(err) + } if res.StatusCode == http.StatusNotFound { return nil, nil }