Skip to content

Commit

Permalink
Split err and status checks to avoid a null dereference error
Browse files Browse the repository at this point in the history
  • Loading branch information
vimystic committed Jul 27, 2023
1 parent 4575a7a commit 88262a5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 88262a5

Please sign in to comment.