From ac1bc95551d1c3fb3a16925a3ff4f501d90b8a3a Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 28 Sep 2024 13:59:03 +0300 Subject: [PATCH] Xtra Type Cafety --- public/scripts/textgen-settings.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 37f8b7d3c..9403555bd 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -812,6 +812,10 @@ function showTypeSpecificControls(type) { * @returns {void} */ function insertMissingArrayItems(source, target) { + if (source === target || !Array.isArray(source) || !Array.isArray(target)) { + return; + } + for (const item of source) { if (!target.includes(item)) { const index = source.indexOf(item);