From 5a330acabcd74aed5996173cb25af43772de011a Mon Sep 17 00:00:00 2001 From: Leppunen Date: Tue, 4 Apr 2023 22:30:19 +0300 Subject: [PATCH] Check if emotes exist in 7tv api response --- web/src/hooks/use7tvChannelEmotes.ts | 2 +- web/src/types/7tv.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/hooks/use7tvChannelEmotes.ts b/web/src/hooks/use7tvChannelEmotes.ts index 1799a5f..a244bfc 100644 --- a/web/src/hooks/use7tvChannelEmotes.ts +++ b/web/src/hooks/use7tvChannelEmotes.ts @@ -29,7 +29,7 @@ export function use7tvChannelEmotes(channelId: string): Array { const emotes = []; - for (const channelEmote of data?.emote_set.emotes ?? []) { + for (const channelEmote of data?.emote_set?.emotes ?? []) { const webpEmotes = channelEmote.data.host.files.filter(i => i.format === 'WEBP'); const emoteURL = channelEmote.data.host.url; emotes.push({ diff --git a/web/src/types/7tv.ts b/web/src/types/7tv.ts index 847a05f..f81f2ca 100644 --- a/web/src/types/7tv.ts +++ b/web/src/types/7tv.ts @@ -6,7 +6,7 @@ interface StvGlobal { } interface StvChannel { - emote_set: StvEmoteSet; + emote_set: StvEmoteSet | null; } interface StvEmoteSet {