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>

cd4364d311eca90a6ee3630b02df7ccf046aaab9

DeclineThyself <235079501+DeclineThyself@users.noreply.github.com>

Signed
1 files changed, +8 -0Showing whitespace changes
public/script.js+8 -0
@@ -6404,6 +6404,14 @@ export function ensureSwipes(message) {
64046404 updated = true;
64056405 }
64066406
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+
64076415 if (typeof message.swipe_id !== 'number') {
64086416 message.swipe_id = 0;
64096417 updated = true;