Empty `swipes` are not handled by `ensureSwipes`. (#4828) * Handle empty swipes. * Add warning. * Replace with forEach * Replace with for loop --------- Co-authored-by: user <user@exmaple.com> Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Signed| @@ -6404,6 +6404,14 @@ export function ensureSwipes(message) { | ||
| 6404 | 6404 | updated = true; |
| 6405 | 6405 | } |
| 6406 | 6406 | |
| 6407 | + for (let i = 0; i < message.swipes.length; i++) { | |
| 6408 | + if (typeof message.swipes[i] !== 'string') { | |
| 6409 | + updated = true; | |
| 6410 | + console.warn('The message had a swipe that is not a string. It has has been set to \'\'.', message); | |
| 6411 | + message.swipes[i] = ''; | |
| 6412 | + } | |
| 6413 | + } | |
| 6414 | + | |
| 6407 | 6415 | if (typeof message.swipe_id !== 'number') { |
| 6408 | 6416 | message.swipe_id = 0; |
| 6409 | 6417 | updated = true; |