From 243937fa8f8d60b1c3cbe7da2cd68d777ec763df Mon Sep 17 00:00:00 2001 From: Mathew Wicks Date: Tue, 8 Aug 2023 18:31:23 -0700 Subject: [PATCH] fix: nil pointer on download error (#12) Signed-off-by: Mathew Wicks --- internal/generate/source.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/generate/source.go b/internal/generate/source.go index 686754c..95df06d 100644 --- a/internal/generate/source.go +++ b/internal/generate/source.go @@ -160,7 +160,7 @@ func (h *SourceHelper) getReleaseByVersion(version string) (*github.RepositoryRe release, resp, err := client.Repositories.GetReleaseByTag(context.Background(), h.GithubOwner, h.GithubRepo, tagName) if err != nil { - if resp.StatusCode == http.StatusNotFound { + if resp != nil && resp.StatusCode == http.StatusNotFound { return nil, fmt.Errorf("no github release found with tag '%s'", tagName) } return nil, err