Skip to content

Commit

Permalink
Prevent nil pointer dereference on failed DNS lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick committed Aug 10, 2019
1 parent 0021a56 commit 5854ae1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ func main() {
r = r.WithContext(ctx)
g.Go(func() error {
resp, err := http.DefaultClient.Do(r)
defer log.Printf("GET %s (%d)", file, resp.StatusCode)
if resp != nil {
defer log.Printf("GET %s (%d)", file, resp.StatusCode)
}
if err != nil {
return err
}
Expand Down

0 comments on commit 5854ae1

Please sign in to comment.