1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-07-05 00:59:04 +02:00

fix: possible nil pointers on logs

refs https://github.com/goreleaser/goreleaser/pull/3966/files#r1460694856

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker
2024-01-21 21:46:59 -03:00
parent ac398de727
commit 6097ea50f5
3 changed files with 39 additions and 26 deletions

View File

@ -132,8 +132,11 @@ func (c *githubClient) getDefaultBranch(ctx *context.Context, repo Repo) (string
c.checkRateLimit(ctx)
p, res, err := c.client.Repositories.Get(ctx, repo.Owner, repo.Name)
if err != nil {
log.WithField("projectID", repo.String()).
WithField("statusCode", res.StatusCode).
log := log.WithField("projectID", repo.String())
if res != nil {
log = log.WithField("statusCode", res.StatusCode)
}
log.
WithError(err).
Warn("error checking for default branch")
return "", err