Add couple of extra type checks
| @@ -6099,7 +6099,7 @@ export function syncMesToSwipe(messageId = null) { | |||
| 6099 | } | 6099 | } |
| 6100 | 6100 | ||
| 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 | } |
| 6121 | 6121 | ||
| 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 | } |
| 6126 | 6126 | ||