Skip to content

Commit

Permalink
Add nil pointer check before validating annotations to avoid nil poin…
Browse files Browse the repository at this point in the history
…ter deference (#1026)
  • Loading branch information
panyuenlau committed Jul 31, 2023
1 parent a384f4b commit eb441d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/v1alpha1/kafkauser_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (spec *KafkaUserSpec) GetAnnotations() map[string]string {
// ValidateAnnotations checks if certificate signing request annotations are valid
func (spec *KafkaUserSpec) ValidateAnnotations() error {
// Validate annotations for cert-manager pki backend signer
if strings.Split(spec.PKIBackendSpec.SignerName, "/")[0] == CertManagerSignerNamePrefix {
if spec.PKIBackendSpec != nil && strings.Split(spec.PKIBackendSpec.SignerName, "/")[0] == CertManagerSignerNamePrefix {
certManagerCSRAnnotations := newCertManagerSignerAnnotationsWithValidators()
err := certManagerCSRAnnotations.validate(spec.GetAnnotations())
if err != nil {
Expand Down

0 comments on commit eb441d8

Please sign in to comment.