Skip to content

Commit

Permalink
Avoid nil dereferencing on errors
Browse files Browse the repository at this point in the history
This merges caddyserver#204 to a similar place in config.go.
  • Loading branch information
ankon committed Sep 23, 2022
1 parent 9826a4c commit d85ea31
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config.go
Expand Up @@ -785,7 +785,9 @@ func (cfg *Config) renewCert(ctx context.Context, name string, force, interactiv
// try to obtain from each issuer until we succeed
var issuedCert *IssuedCertificate
var issuerUsed Issuer
var issuerKeys []string
for _, issuer := range cfg.Issuers {
issuerKeys = append(issuerKeys, issuer.IssuerKey())
if prechecker, ok := issuer.(PreChecker); ok {
err = prechecker.PreCheck(ctx, []string{name}, interactive)
if err != nil {
Expand Down Expand Up @@ -818,7 +820,7 @@ func (cfg *Config) renewCert(ctx context.Context, name string, force, interactiv
"renewal": true,
"identifier": name,
"remaining": timeLeft,
"issuer": issuerUsed.IssuerKey(),
"issuers": issuerKeys,
"storage_key": certRes.NamesKey(),
"error": err,
})
Expand Down

0 comments on commit d85ea31

Please sign in to comment.