Fix panic when ref is mis-used

This commit is contained in:
quobix
2024-04-29 11:21:35 -04:00
parent 6f277db292
commit 7e86e991b2

View File

@@ -503,7 +503,9 @@ func IsNodeRefValue(node *yaml.Node) (bool, *yaml.Node, string) {
for i, r := range n.Content { for i, r := range n.Content {
if i%2 == 0 { if i%2 == 0 {
if r.Value == "$ref" { if r.Value == "$ref" {
return true, r, n.Content[i+1].Value if i+1 < len(n.Content) {
return true, r, n.Content[i+1].Value
}
} }
} }
} }