mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add couple of extra type checks
This commit is contained in:
@@ -6099,7 +6099,7 @@ export function syncMesToSwipe(messageId = null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const targetMessageId = messageId ?? chat.length - 1;
|
const targetMessageId = messageId ?? chat.length - 1;
|
||||||
if (chat.length > targetMessageId) {
|
if (chat.length > targetMessageId || targetMessageId < 0) {
|
||||||
console.warn(`[syncMesToSwipe] Invalid message ID: ${messageId}`);
|
console.warn(`[syncMesToSwipe] Invalid message ID: ${messageId}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -6120,7 +6120,7 @@ export function syncMesToSwipe(messageId = null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const targetSwipeInfo = targetMessage.swipe_info[targetMessage.swipe_id];
|
const targetSwipeInfo = targetMessage.swipe_info[targetMessage.swipe_id];
|
||||||
if (typeof targetSwipeInfo !== 'object') {
|
if (!targetSwipeInfo || typeof targetSwipeInfo !== 'object') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user