Add couple of extra type checks

7def85a1740af7cb89307c34b3f632477d089136

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +2 -2Showing whitespace changes
public/script.js+2 -2
@@ -6099,7 +6099,7 @@ export function syncMesToSwipe(messageId = null) {
6099 }6099 }
61006100
6101 const targetMessageId = messageId ?? chat.length - 1;6101 const targetMessageId = messageId ?? chat.length - 1;
6102 if (chat.length > targetMessageId) {6102 if (chat.length > targetMessageId || targetMessageId < 0) {
6103 console.warn(`[syncMesToSwipe] Invalid message ID: ${messageId}`);6103 console.warn(`[syncMesToSwipe] Invalid message ID: ${messageId}`);
6104 return false;6104 return false;
6105 }6105 }
@@ -6120,7 +6120,7 @@ export function syncMesToSwipe(messageId = null) {
6120 }6120 }
61216121
6122 const targetSwipeInfo = targetMessage.swipe_info[targetMessage.swipe_id];6122 const targetSwipeInfo = targetMessage.swipe_info[targetMessage.swipe_id];
6123 if (typeof targetSwipeInfo !== 'object') {6123 if (!targetSwipeInfo || typeof targetSwipeInfo !== 'object') {
6124 return false;6124 return false;
6125 }6125 }
61266126