Fix trainer-related crash when loading data

pull/16/head
Flashfyre 2024-03-21 01:05:46 -04:00
parent 4fc92f22d9
commit b201cf0abc
1 changed files with 2 additions and 2 deletions

View File

@ -576,8 +576,8 @@ export class GameData {
scene.updateScoreText();
const battleType = sessionData.battleType || 0;
const trainerConfig = trainerConfigs[sessionData.trainer.trainerType];
const battle = scene.newBattle(sessionData.waveIndex, battleType, sessionData.trainer, battleType === BattleType.TRAINER ? trainerConfig.doubleOnly || sessionData.trainer.variant === TrainerVariant.DOUBLE : sessionData.enemyParty.length > 1);
const trainerConfig = sessionData.trainer ? trainerConfigs[sessionData.trainer.trainerType] : null;
const battle = scene.newBattle(sessionData.waveIndex, battleType, sessionData.trainer, battleType === BattleType.TRAINER ? trainerConfig?.doubleOnly || sessionData.trainer?.variant === TrainerVariant.DOUBLE : sessionData.enemyParty.length > 1);
battle.enemyLevels = sessionData.enemyParty.map(p => p.level);
scene.newArena(sessionData.arena.biome, true);