Skip to content

Commit 2fb74b7

Browse files
committed
Null values from array indexing inside $map dropped #112
small follow-up to make the code a bit more concise
1 parent 78ac71a commit 2fb74b7

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

src/main/java/com/dashjoin/jsonata/Jsonata.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,8 @@ Frame createFrameFromTuple(Frame environment, Map<String, Object> tuple) {
502502
if( input instanceof JList && ((JList)input).tupleStream) {
503503
((JList)results).tupleStream = true;
504504
}
505-
if (input == null) {
506-
// undefined input yields undefined output; skip filtering entirely
507-
input = Utils.createSequence();
508-
} else if (!(input instanceof List)) { // isArray
509-
input = Utils.createSequence(input);
505+
if (!(input instanceof List)) { // isArray
506+
input = Utils.createSequence(input == null ? Utils.NONE : input);
510507
}
511508
if (predicate.type.equals("number")) {
512509
var index = ((Number)predicate.value).intValue(); // round it down - was Math.floor

0 commit comments

Comments
 (0)