From c027b2dec1a8886a525520e9ce8ae9db20342272 Mon Sep 17 00:00:00 2001 From: Mashy Date: Sun, 15 Sep 2019 17:56:51 +1000 Subject: [PATCH] check for null objects --- client/src/events.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/events.jsx b/client/src/events.jsx index 242e2888..3e0943fd 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -72,12 +72,12 @@ function registerEvents(store) { const text = animations.getText(r, sequence); store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r, game))); - if (sequence.includes('START_SKILL')) store.dispatch(actions.setAnimSource(anims.animSource)); - if (sequence.includes('END_SKILL')) { + if (sequence.includes('START_SKILL') && anims.animSource) store.dispatch(actions.setAnimSource(anims.animSource)); + if (sequence.includes('END_SKILL') && anims.animTarget) { store.dispatch(actions.setAnimTarget(anims.animTarget)); if (!['Banish', 'Invert'].includes(removeTier(anims.animTarget.skill))) store.dispatch(actions.setAnimCb(cb)); } - if (sequence.includes('POST_SKILL')) { + if (sequence.includes('POST_SKILL' && text)) { // timeout to prevent text classes from being added too soon setTimeout( () => store.dispatch(actions.setAnimText(text)),