Skip to content

Commit

Permalink
fix nil pointer in ClusterClass webhook ref validation
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Büringer [email protected]
  • Loading branch information
sbueringer committed Aug 20, 2021
1 parent 71d1a34 commit f950b4c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/v1alpha4/clusterclass_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ func (in ClusterClass) validateMachineDeploymentsChanges(old *ClusterClass) fiel
func (r LocalObjectTemplate) validate(namespace string, pathPrefix *field.Path) field.ErrorList {
var allErrs field.ErrorList

// check if ref is not nil.
if r.Ref == nil {
return field.ErrorList{field.Invalid(
pathPrefix.Child("ref"),
r.Ref.Name,
"cannot be nil",
)}
}

// check if a name is provided
if r.Ref.Name == "" {
allErrs = append(allErrs,
Expand Down

0 comments on commit f950b4c

Please sign in to comment.