From 4245430561fad790ff74b4272506a4a897c02054 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 12 Oct 2021 16:13:07 +0100 Subject: [PATCH] Fix issue deeply extract falsey values from context while executing JS bindings --- packages/string-templates/src/helpers/javascript.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/string-templates/src/helpers/javascript.js b/packages/string-templates/src/helpers/javascript.js index cba3966213..301833fd34 100644 --- a/packages/string-templates/src/helpers/javascript.js +++ b/packages/string-templates/src/helpers/javascript.js @@ -19,7 +19,10 @@ const removeSquareBrackets = value => { const getContextValue = (path, context) => { let data = context path.split(".").forEach(key => { - data = data[removeSquareBrackets(key)] || {} + if (data == null || typeof data !== "object") { + return null + } + data = data[removeSquareBrackets(key)] }) return data }