Fixed npe in log #1596

This commit is contained in:
Mike Farah 2023-03-15 13:57:47 +11:00
parent 08a6cb65fe
commit 360a47fddc
2 changed files with 8 additions and 1 deletions

View File

@ -82,10 +82,11 @@ func variableLoopSingleChild(d *dataTreeNavigator, context Context, originalExp
newContext.SetVariable(variableName, variableValue) newContext.SetVariable(variableName, variableValue)
rhs, err := d.GetMatchingNodes(newContext, originalExp.RHS) rhs, err := d.GetMatchingNodes(newContext, originalExp.RHS)
log.Debug("PROCESSING VARIABLE DONE, got back: ", rhs.MatchingNodes.Len())
if err != nil { if err != nil {
return Context{}, err return Context{}, err
} }
log.Debug("PROCESSING VARIABLE DONE, got back: ", rhs.MatchingNodes.Len())
results.PushBackList(rhs.MatchingNodes) results.PushBackList(rhs.MatchingNodes)
} }

View File

@ -13,6 +13,12 @@ var variableOperatorScenarios = []expressionScenario{
"D0, P[], (doc)::{}\n", "D0, P[], (doc)::{}\n",
}, },
}, },
{
skipDoc: true,
document: `{}`,
expression: `.a.b as $foo`,
expectedError: "must use variable with a pipe, e.g. `exp as $x | ...`",
},
{ {
document: "a: [cat]", document: "a: [cat]",
skipDoc: true, skipDoc: true,