Skip to content

Commit

Permalink
Merge pull request #158 from ericrpowers/requestToken-panic
Browse files Browse the repository at this point in the history
Fixed: Try to drain response body only if response exists
  • Loading branch information
dgellow committed Nov 4, 2019
2 parents 99ad65f + d5897c3 commit 3b2151a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docker/docker.go
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 3b2151a

Please sign in to comment.