Fixed length of null to be zero

This commit is contained in:
Mike Farah
2021-02-11 10:58:40 +11:00
parent 61f569aebb
commit 820a3320be
3 changed files with 43 additions and 1 deletions
+5 -1
View File
@@ -17,7 +17,11 @@ func lengthOperator(d *dataTreeNavigator, matchMap *list.List, expressionNode *E
var length int
switch targetNode.Kind {
case yaml.ScalarNode:
length = len(targetNode.Value)
if targetNode.Tag == "!!null" {
length = 0
} else {
length = len(targetNode.Value)
}
case yaml.MappingNode:
length = len(targetNode.Content) / 2
case yaml.SequenceNode: