From 1b7ccb191216b54cced415ca4e908fdd3eec2ef4 Mon Sep 17 00:00:00 2001 From: snoozbuster Date: Tue, 13 Aug 2024 21:10:11 -0700 Subject: [PATCH] don't crash if a test faints a pokemon between CommandPhase and TurnStartPhase --- src/phases.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/phases.ts b/src/phases.ts index 7a745a386fe..94a33fa9285 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2372,8 +2372,8 @@ export class TurnStartPhase extends FieldPhase { } } - if (battlerBypassSpeed[a].value !== battlerBypassSpeed[b].value) { - return battlerBypassSpeed[a].value ? -1 : 1; + if (battlerBypassSpeed[a]?.value !== battlerBypassSpeed[b]?.value) { + return battlerBypassSpeed[a]?.value ? -1 : 1; } const aIndex = order.indexOf(a);