From c6f5906aa12f4a281d5eb0516aa437fd1c6910bf Mon Sep 17 00:00:00 2001 From: Anthony Sterling Date: Mon, 13 Jul 2020 13:24:20 +0100 Subject: [PATCH] add nil check for create repo response --- src/push.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/push.go b/src/push.go index 8ebe231..008b72e 100644 --- a/src/push.go +++ b/src/push.go @@ -93,7 +93,7 @@ func getOrCreateGitHubRepo(ctx context.Context, client *github.Client, repoName, HasProjects: github.Bool(false), } ghRepo, resp, err := client.Repositories.Create(ctx, orgName, repo) - if resp.StatusCode == 422 { + if resp != nil && resp.StatusCode == 422 { ghRepo, _, err = client.Repositories.Get(ctx, orgName, repoName) } if err != nil {