Skip to content

Commit e41f58e

Browse files
author
Nico Verwer
committed
set user in context in fn:apply, when needed
1 parent 62a3579 commit e41f58e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

exist-core/src/main/java/org/exist/xquery/functions/fn/FunHigherOrderFun.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ public Sequence eval(final Sequence[] args, final Sequence contextSequence)
224224
}
225225
} else if (isCalledAs("apply")) {
226226
try (final FunctionReference ref = (FunctionReference) args[0].itemAt(0)) {
227+
// Sometimes the function reference has no realUser in its context. In that case we set it using prepareForExecution().
228+
if (ref.getCall().getContext().getRealUser() == null)
229+
ref.getCall().getContext().prepareForExecution();
227230
ref.analyze(cachedContextInfo);
228231
final ArrayType array = (ArrayType) args[1].itemAt(0);
229232
if (funcRefHasDifferentArity(ref, array.getSize())) {

0 commit comments

Comments
 (0)