cmd/gerritbot: check for nil *github.Response before accessing

When github.Client.Do returns a non-nil error, the *github.Response
may be nil if a request wasn't even made. Check for that to avoid a
panic.

Fixes golang/go#44438.

Change-Id: I199048213160eb08892ca0c830af09959c5a4ffc
Reviewed-on: https://go-review.googlesource.com/c/build/+/294412
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
diff --git a/cmd/gerritbot/gerritbot.go b/cmd/gerritbot/gerritbot.go
index 45b9a49..893b205 100644
--- a/cmd/gerritbot/gerritbot.go
+++ b/cmd/gerritbot/gerritbot.go
@@ -831,7 +831,7 @@
 	resp, err := b.githubClient.Do(ctx, req, pr)
 	logGitHubRateLimits(resp)
 	if err != nil {
-		if resp.StatusCode == http.StatusNotModified {
+		if resp != nil && resp.StatusCode == http.StatusNotModified {
 			log.Println("Returning cached version of", shortLink)
 			return cpr.pr, nil
 		}