Skip to content

Commit

Permalink
Merge pull request #148 from justabaka/fix-null-pointer-dereference
Browse files Browse the repository at this point in the history
Fix Nil Pointer Dereference on HTTP Client errors
  • Loading branch information
michaelklishin authored Mar 4, 2020
2 parents 84a53c6 + 25fad82 commit a4ba81f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ func executeRequest(client *Client, req *http.Request) (res *http.Response, err
httpc.Transport = client.transport
}
resp, err := httpc.Do(req)
if err != nil {
return nil, err
}

if resp.StatusCode == 401 {
return nil, errors.New("Error: API responded with a 401 Unauthorized")
Expand Down

0 comments on commit a4ba81f

Please sign in to comment.