Reported by vacuum issue, this use-case is now handled correctly and prevents a panic.

Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
quobix
2023-11-05 09:16:08 -05:00
parent 3fb4865f08
commit ff40cfad85
2 changed files with 16 additions and 0 deletions

View File

@@ -253,6 +253,9 @@ func FindKeyNode(key string, nodes []*yaml.Node) (keyNode *yaml.Node, valueNode
//numNodes := len(nodes)
for i, v := range nodes {
if i%2 == 0 && key == v.Value {
if len(nodes) <= i+1 {
return v, nodes[i]
}
return v, nodes[i+1] // next node is what we need.
}
for x, j := range v.Content {