From 502b1a20c582c87b88cfc409735c5443d16d4e4f Mon Sep 17 00:00:00 2001 From: innerthunder Date: Thu, 14 Nov 2024 17:43:14 -0800 Subject: [PATCH] Add failsafe to Commander remove anim --- src/phases/pokemon-anim-phase.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/phases/pokemon-anim-phase.ts b/src/phases/pokemon-anim-phase.ts index ad0be34af7d..eb5431cbc56 100644 --- a/src/phases/pokemon-anim-phase.ts +++ b/src/phases/pokemon-anim-phase.ts @@ -312,6 +312,10 @@ export class PokemonAnimPhase extends BattlePhase { // Note: unlike the other Commander animation, this is played through the // Dondozo instead of the Tatsugiri. const tatsugiri = this.pokemon.getAlly(); + if (isNullOrUndefined(tatsugiri)) { + console.warn("Aborting COMMANDER_REMOVE anim: Tatsugiri is undefined"); + return this.end(); + } const tatsuSprite = this.scene.addPokemonSprite( tatsugiri,