From b0fcedd3f32cc849c7bddc92dded3bc238309fad Mon Sep 17 00:00:00 2001 From: Jiiks Date: Sat, 10 Mar 2018 10:21:35 +0200 Subject: [PATCH] Don't do anything if emotes don't exist --- client/src/builtin/EmoteModule.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/client/src/builtin/EmoteModule.js b/client/src/builtin/EmoteModule.js index 9bb29aaa..dd66bfce 100644 --- a/client/src/builtin/EmoteModule.js +++ b/client/src/builtin/EmoteModule.js @@ -17,11 +17,16 @@ export default class { static async observe() { const dataPath = Globals.getObject('paths').find(path => path.id === 'data').path; - emotes = await FileUtils.readJsonFromFile(dataPath + '/emotes.json'); - window.emotee = emotes; - Events.on('ui:mutable:.markup', markup => { - this.injectEmotes(markup); - }); + try { + emotes = await FileUtils.readJsonFromFile(dataPath + '/emotes.json'); + Events.on('ui:mutable:.markup', + markup => { + if (!emotes) return; + this.injectEmotes(markup); + }); + } catch (err) { + console.log(err); + } } static injectEmotes(node) {