mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 20:47:44 +00:00
Off by one issue fixed https://github.com/daveshanley/vacuum/issues/356
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user