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