Skip to content

Commit

Permalink
Fixed: Try to drain response body only if response exists
Browse files Browse the repository at this point in the history
  • Loading branch information
eric committed Oct 25, 2019
1 parent 99ad65f commit d5897c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@ func (i *Image) requestToken(resp *http.Response) (string, error) {
}
tResp, err := i.client.Do(req)
if err != nil {
io.Copy(ioutil.Discard, tResp.Body)
if tResp != nil {
io.Copy(ioutil.Discard, tResp.Body)
}
return "", err
}

Expand Down

0 comments on commit d5897c3

Please sign in to comment.