From 3b2dcd60da0dcc4573955d81ae576bfa833563f3 Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Mon, 22 Jul 2024 19:06:02 -0400 Subject: [PATCH] add console warning when delete set is not found in list --- .../scripts/extensions/quick-reply/src/QuickReplySet.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/scripts/extensions/quick-reply/src/QuickReplySet.js b/public/scripts/extensions/quick-reply/src/QuickReplySet.js index dddd0a8bb..2fff047b0 100644 --- a/public/scripts/extensions/quick-reply/src/QuickReplySet.js +++ b/public/scripts/extensions/quick-reply/src/QuickReplySet.js @@ -408,8 +408,12 @@ export class QuickReplySet { if (response.ok) { this.unrender(); const idx = QuickReplySet.list.indexOf(this); - QuickReplySet.list.splice(idx, 1); - this.isDeleted = true; + if (idx > -1) { + QuickReplySet.list.splice(idx, 1); + this.isDeleted = true; + } else { + warn(`Deleted Quick Reply Set was not found in the list of sets: ${this.name}`); + } } else { warn(`Failed to delete Quick Reply Set: ${this.name}`); }