From ca0fc3bd5ee75bfb3d89e203333b77e8826c7ee5 Mon Sep 17 00:00:00 2001 From: Marty-D Date: Thu, 12 Oct 2017 22:45:06 -0400 Subject: [PATCH] Tooltips: Fix crash in switch menu --- js/client-battle-tooltips.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/client-battle-tooltips.js b/js/client-battle-tooltips.js index e6de413ce..782b62ea0 100644 --- a/js/client-battle-tooltips.js +++ b/js/client-battle-tooltips.js @@ -414,10 +414,12 @@ var BattleTooltips = (function () { if (pokemonData) exacthp = ' (' + pokemonData.hp + '/' + pokemonData.maxhp + ')'; else if (pokemon.maxhp == 48) exacthp = ' (' + pokemon.hp + '/' + pokemon.maxhp + ' pixels)'; text += '

HP: ' + pokemon.hpDisplay() + exacthp + (pokemon.status ? ' ' + pokemon.status.toUpperCase() + '' : ''); - if (pokemon.status === 'tox') { - text += ' Next damage: ' + Math.floor(100 / 16) * Math.min(pokemon.statusData.toxicTurns, 15) + '%'; - } else if (pokemon.status === 'slp') { - text += ' Turns asleep: ' + pokemon.statusData.sleepTurns; + if (pokemon.statusData) { + if (pokemon.status === 'tox') { + text += ' Next damage: ' + Math.floor(100 / 16) * Math.min(pokemon.statusData.toxicTurns, 15) + '%'; + } else if (pokemon.status === 'slp') { + text += ' Turns asleep: ' + pokemon.statusData.sleepTurns; + } } text += '

'; }