From 2fbaca7b5e7f1c0c92a4098e1114b96e8ce23b9b Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Mon, 7 Jul 2025 21:10:32 -0600 Subject: [PATCH] [Bug] Prevent save corruption when loading a pokemonData that has no moves (#6070) Prevent save corruption when loading a pokemonData that has no moves --- src/system/pokemon-data.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/pokemon-data.ts b/src/system/pokemon-data.ts index 85f7b12a2a5..28763fe970a 100644 --- a/src/system/pokemon-data.ts +++ b/src/system/pokemon-data.ts @@ -105,7 +105,7 @@ export default class PokemonData { // TODO: Can't we move some of this verification stuff to an upgrade script? this.nature = source.nature ?? Nature.HARDY; - this.moveset = source.moveset.map((m: any) => PokemonMove.loadMove(m)); + this.moveset = source.moveset?.map((m: any) => PokemonMove.loadMove(m)) ?? []; this.status = source.status ? new Status(source.status.effect, source.status.toxicTurnCount, source.status.sleepTurnsRemaining) : null;