[Bug] Prevent save corruption when loading a pokemonData that has no moves (#6070)

Prevent save corruption when loading a pokemonData that has no moves
This commit is contained in:
Sirz Benjie 2025-07-07 21:10:32 -06:00 committed by GitHub
parent 115d63d0c5
commit 2fbaca7b5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;