From f99e79236efbf9bebcefeb7700e7f986928ad206 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Sun, 31 Jul 2022 16:21:10 +0530 Subject: [PATCH] Bug fix --- src/app/organisms/emoji-board/custom-emoji.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/organisms/emoji-board/custom-emoji.js b/src/app/organisms/emoji-board/custom-emoji.js index 6ac760cb..996d8532 100644 --- a/src/app/organisms/emoji-board/custom-emoji.js +++ b/src/app/organisms/emoji-board/custom-emoji.js @@ -143,10 +143,10 @@ class ImagePack { function getGlobalImagePacks(mx) { const globalContent = mx.getAccountData('im.ponies.emote_rooms')?.getContent(); - if (typeof globalContent !== 'object') return null; + if (typeof globalContent !== 'object') return []; const { rooms } = globalContent; - if (typeof rooms !== 'object') return null; + if (typeof rooms !== 'object') return []; const roomIds = Object.keys(rooms); @@ -206,7 +206,11 @@ function getRelevantPacks(mx, rooms) { const globalPackIds = new Set(globalPacks.map((pack) => pack.id)); const roomsPack = rooms?.flatMap(getRoomImagePacks) ?? []; - return [].concat(userPack, globalPacks, roomsPack.filter((pack) => !globalPackIds.has(pack.id))); + return [].concat( + userPack ?? [], + globalPacks, + roomsPack.filter((pack) => !globalPackIds.has(pack.id)), + ); } function getShortcodeToEmoji(room) {