Skip to content

Commit d88131f

Browse files
committed
fix: vaoid panic in case no Options passed
1 parent ed7d365 commit d88131f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

kustomize/commands/edit/fix/convert.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,13 @@ func writePatchTargets(patch types.Patch, node *kyaml.RNode, fieldPaths []string
299299
if options[i].String() != "" {
300300
target.Options = options[i]
301301
}
302-
if patch.Options.AllowNameChange {
303-
target.Select.ResId.Name = node.GetName()
304-
}
305-
if patch.Options.AllowKindChange {
306-
target.Select.ResId.Kind = node.GetKind()
302+
if patch.Options != nil {
303+
if patch.Options.AllowNameChange {
304+
target.Select.ResId.Name = node.GetName()
305+
}
306+
if patch.Options.AllowKindChange {
307+
target.Select.ResId.Kind = node.GetKind()
308+
}
307309
}
308310
if node.GetNamespace() != "" {
309311
target.Select.ResId.Namespace = node.GetNamespace()

0 commit comments

Comments
 (0)