From a1772c00058d03ee1e4a6e3ba8f96ba2197e3f2b Mon Sep 17 00:00:00 2001 From: Dimitris - Rafail Katsampas Date: Tue, 8 Mar 2022 17:36:58 +0200 Subject: [PATCH] feat: proper handling for bindings with converters that were undefined (#9813) --- .../core/ui/core/bindable/bindable-expressions.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/core/ui/core/bindable/bindable-expressions.ts b/packages/core/ui/core/bindable/bindable-expressions.ts index 1861e079f..6954030e9 100644 --- a/packages/core/ui/core/bindable/bindable-expressions.ts +++ b/packages/core/ui/core/bindable/bindable-expressions.ts @@ -91,7 +91,17 @@ const expressionParsers = { if (expression.operator == '|') { if (converterExpression.nsRequiresConverter) { - return expression.right.nsIsCallable ? right : right?.(left); + if (expression.right.nsIsCallable) { + return right; + } + + if (isFunction(right)) { + return right(left); + } + + if (isNullOrUndefined(right)) { + throw new Error('Cannot perform a call using a null or undefined property'); + } } throw new Error('Invalid converter syntax'); }