mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Fixed panic error #2211
This commit is contained in:
parent
e204677ff8
commit
5273715428
@ -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]
|
||||
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user