From 4237eb4aa80c6bd7d3a39a96e1c703e48a0d4c9a Mon Sep 17 00:00:00 2001 From: Jeff Cook Date: Sat, 19 Aug 2023 22:57:39 -0600 Subject: [PATCH] Skip replacement if there is no replace function on the value. ... Came across a workflow that was feeding an int 6 in here. Workflow in question at https://civitai.com/models/119528/sdxl-10-comfyui-ultimate-workflow, v3.1. --- js/presetText.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/presetText.js b/js/presetText.js index 4418dfb..c7c22cf 100644 --- a/js/presetText.js +++ b/js/presetText.js @@ -182,7 +182,7 @@ app.registerExtension({ const callbacks = [ () => { let prompt = widget.value; - if (replaceRegex) { + if (replaceRegex && typeof prompt.replace !== 'undefined') { prompt = prompt.replace(replaceRegex, (match, p1, p2, index, text, groups) => { if (!groups.replace || !groups.id) return match; // No match, bad regex?