diff --git a/services/github/client.go b/services/github/client.go index 3ffc56147..ae9b12c21 100644 --- a/services/github/client.go +++ b/services/github/client.go @@ -29,7 +29,9 @@ func NewClient() Client { func (c client) GetLatestRelease(ctx context.Context) (*github.RepositoryRelease, error) { latestRelease, githubResponse, err := c.githubRepositoriesService.GetLatestRelease(ctx, "Scalingo", "cli") - defer githubResponse.Body.Close() + if githubResponse != nil && githubResponse.Body != nil { + defer githubResponse.Body.Close() + } debug.Printf("GitHub response: %#v\n", githubResponse)