From 738c98eb475feef3c83b61fa1b63c7801cceafba Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 21 Oct 2022 10:32:32 +0100 Subject: [PATCH] Ensure non string types are ignored when searching for HBS blocks --- packages/string-templates/src/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/string-templates/src/index.js b/packages/string-templates/src/index.js index eae545de14..ab7afc1dcc 100644 --- a/packages/string-templates/src/index.js +++ b/packages/string-templates/src/index.js @@ -323,6 +323,9 @@ module.exports.doesContainStrings = (template, strings) => { * @return {string[]} The found HBS blocks. */ module.exports.findHBSBlocks = string => { + if (!string || typeof string !== "string") { + return [] + } let regexp = new RegExp(FIND_ANY_HBS_REGEX) let matches = string.match(regexp) if (matches == null) {