Don't do anything if emotes don't exist

This commit is contained in:
Jiiks 2018-03-10 10:21:35 +02:00
parent fe319e58fe
commit b0fcedd3f3
1 changed files with 10 additions and 5 deletions

View File

@ -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) {