From ff22834bdef444848531968b21b947290a167117 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Tue, 15 Jun 2021 22:40:41 -0700 Subject: [PATCH] Avoid panic when secret is nil --- factory/gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/factory/gen.go b/factory/gen.go index 1982932..6922f51 100644 --- a/factory/gen.go +++ b/factory/gen.go @@ -179,7 +179,7 @@ func populateCN(secret *v1.Secret, cn ...string) *v1.Secret { // IsStatic returns true if the Secret has an attribute indicating that it contains // a static (aka user-provided) certificate, which should not be modified. func IsStatic(secret *v1.Secret) bool { - if secret.Annotations != nil { + if secret != nil && secret.Annotations != nil { return secret.Annotations[Static] == "true" } return false