From 31af36b8bde129924053049038b8b3dd0d6cc6e9 Mon Sep 17 00:00:00 2001 From: Romain Dunand Date: Sun, 1 Dec 2019 23:08:37 +0100 Subject: [PATCH 1/2] Fix #139 Prevent null values from beeing treaded as objects --- packages/workflow/src/Workflow.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/workflow/src/Workflow.ts b/packages/workflow/src/Workflow.ts index 9efaaa67e..b48e380ed 100644 --- a/packages/workflow/src/Workflow.ts +++ b/packages/workflow/src/Workflow.ts @@ -865,16 +865,16 @@ export class Workflow { // Execute the expression try { const returnValue = tmpl.tmpl(parameterValue, dataProxy.getDataProxy()); - if (typeof returnValue === 'object' && Object.keys(returnValue).length === 0) { - // When expression is incomplete it returns a Proxy which causes problems. - // Catch it with this code and return a proper error. - throw new Error('Expression is not valid.'); + if (returnValue !== null && typeof returnValue === 'object') { + if (Object.keys(returnValue).length === 0) { + // When expression is incomplete it returns a Proxy which causes problems. + // Catch it with this code and return a proper error. + throw new Error('Expression is not valid.'); + } + if (returnObjectAsString === true) { + return this.convertObjectValueToString(returnValue); + } } - - if (returnObjectAsString === true && typeof returnValue === 'object') { - return this.convertObjectValueToString(returnValue); - } - return returnValue; } catch (e) { throw new Error('Expression is not valid.'); From b41d40cc95100fe0fd16d39b543e86036f87c2df Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Fri, 7 Feb 2020 17:06:36 -0800 Subject: [PATCH 2/2] :bug: Fix error with displaying null in expression --- packages/editor-ui/src/components/ParameterInput.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor-ui/src/components/ParameterInput.vue b/packages/editor-ui/src/components/ParameterInput.vue index 74c123b52..9f65d462e 100644 --- a/packages/editor-ui/src/components/ParameterInput.vue +++ b/packages/editor-ui/src/components/ParameterInput.vue @@ -276,7 +276,7 @@ export default mixins( returnValue = this.expressionValueComputed; } - if (returnValue !== undefined && this.parameter.type === 'string') { + if (returnValue !== undefined && returnValue !== null && this.parameter.type === 'string') { const rows = this.getArgument('rows'); if (rows === undefined || rows === 1) { returnValue = returnValue.toString().replace(/\n/, '|');