From 88262a59c276943cae6e6c1479e601b165c78070 Mon Sep 17 00:00:00 2001 From: vimystic <122659254+vimystic@users.noreply.github.com> Date: Thu, 27 Jul 2023 09:30:27 -0600 Subject: [PATCH] Split err and status checks to avoid a null dereference error --- cmd/queue.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/queue.go b/cmd/queue.go index 32f6be1..143f52e 100644 --- a/cmd/queue.go +++ b/cmd/queue.go @@ -44,8 +44,11 @@ func mostRecentReleasesForChain( } res, err := client.Do(req) - if err != nil || res.StatusCode != http.StatusOK { - return builder.HeighlinerQueuedChainBuilds{}, fmt.Errorf("error performing github releases request: %v:%v", res.StatusCode, err) + if err != nil { + return builder.HeighlinerQueuedChainBuilds{}, fmt.Errorf("error performing github releases request: %v", err) + } + if res.StatusCode != http.StatusOK { + return builder.HeighlinerQueuedChainBuilds{}, fmt.Errorf("status code: %v", res.StatusCode) } defer res.Body.Close()