From efe54086cede5687506d40d28774fab25b27697b Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 21 Mar 2024 21:53:47 +0200 Subject: [PATCH] +1 less improper null check --- public/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index ac2146f50..5f2e92c4d 100644 --- a/public/script.js +++ b/public/script.js @@ -4750,7 +4750,7 @@ async function saveReply(type, getMessage, fromStreaming, title, swipes) { type = 'normal'; } - if (chat.length && !chat[chat.length - 1]['extra']) { + if (chat.length && (!chat[chat.length - 1]['extra'] || typeof chat[chat.length - 1]['extra'] !== 'object')) { chat[chat.length - 1]['extra'] = {}; } @@ -4899,7 +4899,7 @@ async function saveReply(type, getMessage, fromStreaming, title, swipes) { function saveImageToMessage(img, mes) { if (mes && img.image) { - if (typeof mes.extra !== 'object') { + if (!mes.extra || typeof mes.extra !== 'object') { mes.extra = {}; } mes.extra.image = img.image;