From 2333fe64d0e043e0d5c09a186746979c558d4e4f Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 19 Apr 2024 01:46:15 +0300 Subject: [PATCH] #2107 Check for null reference in prompt manager settings init --- public/scripts/PromptManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/scripts/PromptManager.js b/public/scripts/PromptManager.js index 295c12123..4ab734156 100644 --- a/public/scripts/PromptManager.js +++ b/public/scripts/PromptManager.js @@ -841,7 +841,7 @@ class PromptManager { const promptReferences = this.getPromptOrderForCharacter(this.activeCharacter); for (let i = promptReferences.length - 1; i >= 0; i--) { const reference = promptReferences[i]; - if (-1 === this.serviceSettings.prompts.findIndex(prompt => prompt.identifier === reference.identifier)) { + if (reference && -1 === this.serviceSettings.prompts.findIndex(prompt => prompt.identifier === reference.identifier)) { promptReferences.splice(i, 1); this.log('Removed unused reference: ' + reference.identifier); }