Skip to content

Commit 79284f2

Browse files
committed
[bugfix] empty array constructor thorws error
1 parent 8d4d026 commit 79284f2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

exist-core/src/main/java/org/exist/xquery/functions/array/ArrayConstructor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathExc
7474
}
7575
return new ArrayType(this, context, items);
7676
default:
77-
final Sequence result = arguments.get(0).eval(contextSequence, contextItem);
77+
final Sequence result = arguments.isEmpty() ? Sequence.EMPTY_SEQUENCE : arguments.get(0).eval(contextSequence, contextItem);
7878
return new ArrayType(this, context, result);
7979
}
8080
}

exist-core/src/test/xquery/arrays/arrays.xql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,13 @@ function arr:curly-constructor2($pos as xs:int) {
235235
return $a($pos)
236236
};
237237

238+
declare
239+
%test:assertEmpty
240+
function arr:curly-constructor3() {
241+
let $a := array {}
242+
return $a?*
243+
};
244+
238245
declare
239246
%test:assertTrue
240247
function arr:deep-equal1() {

0 commit comments

Comments
 (0)