Skip to content

Commit 71a2394

Browse files
committed
Return an error if a mutator is nil
1 parent 5fffb0f commit 71a2394

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/clusterctl/client/cluster/mover.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,13 @@ func applyMutators(object client.Object, mutators ...ResourceMutatorFunc) (*unst
13291329
}
13301330
u.SetUnstructuredContent(to)
13311331
for _, mutator := range mutators {
1332-
if err := mutator(u); err != nil {
1332+
var err error
1333+
if mutator != nil {
1334+
err = mutator(u)
1335+
} else {
1336+
err = fmt.Errorf("mutator is nil")
1337+
}
1338+
if err != nil {
13331339
return nil, errors.Wrapf(err, "error applying resource mutator to %q %s/%s",
13341340
u.GroupVersionKind(), object.GetNamespace(), object.GetName())
13351341
}

0 commit comments

Comments
 (0)