Fixed panic error #2211

This commit is contained in:
Mike Farah 2024-12-07 16:20:45 +11:00
parent e204677ff8
commit 5273715428
2 changed files with 10 additions and 1 deletions

View File

@ -264,7 +264,7 @@ func doTraverseMap(newMatches *orderedmap.OrderedMap, node *CandidateNode, wante
// if we don't find a match directly on this node first.
var contents = node.Content
for index := 0; index < len(contents); index = index + 2 {
for index := 0; index+1 < len(contents); index = index + 2 {
key := contents[index]
value := contents[index+1]

View File

@ -35,6 +35,15 @@ steps:
`
var traversePathOperatorScenarios = []expressionScenario{
{
skipDoc: true,
description: "strange map with key but no value",
document: "!!null\n-",
expression: ".x",
expected: []string{
"D0, P[x], (!!null)::null\n",
},
},
{
skipDoc: true,
description: "access merge anchors",