Skip to content

Commit

Permalink
Don't do anything if emotes don't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiiks committed Mar 10, 2018
1 parent fe319e5 commit b0fcedd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions client/src/builtin/EmoteModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b0fcedd

Please sign in to comment.