From 8fa9c06e72d98a460c9fc3ded975b141bd181865 Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Fri, 11 Apr 2025 14:57:13 -0500 Subject: [PATCH] add fallbacks --- src/webpage/emoji.ts | 1 + src/webpage/guild.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/webpage/emoji.ts b/src/webpage/emoji.ts index b463c08..ad31917 100644 --- a/src/webpage/emoji.ts +++ b/src/webpage/emoji.ts @@ -129,6 +129,7 @@ class Emoji { } } for (const guild of localuser.guilds) { + if (!guild.emojis) continue; const emj = guild.emojis.find((_) => _.id === idOrString); if (emj) { return new Emoji(emj, localuser); diff --git a/src/webpage/guild.ts b/src/webpage/guild.ts index e1bd5d1..6d97e5b 100644 --- a/src/webpage/guild.ts +++ b/src/webpage/guild.ts @@ -643,7 +643,7 @@ class Guild extends SnowFlake { update(json: extendedProperties) { this.large = json.large; this.member_count = json.member_count; - this.emojis = json.emojis; + this.emojis = json.emojis || []; this.headers = this.owner.headers; this.properties.features = json.features; if (this.properties.icon !== json.icon) { @@ -669,7 +669,7 @@ class Guild extends SnowFlake { this.owner = owner; this.large = json.large; this.member_count = json.member_count; - this.emojis = json.emojis; + this.emojis = json.emojis || []; this.headers = this.owner.headers; this.channels = []; if (json.properties) { @@ -720,7 +720,7 @@ class Guild extends SnowFlake { } } this.prevchannel = this.localuser.channelids.get(this.perminfo.prevchannel); - this.stickers = json.stickers.map((_) => new Sticker(_, this)); + this.stickers = json.stickers.map((_) => new Sticker(_, this)) || []; } get perminfo() { return this.localuser.perminfo.guilds[this.id];