From 669260155cdcb735ac79ad63edf75e0b9b91d383 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 21 Mar 2024 13:17:43 -0400 Subject: [PATCH] Fix crash on title when no save data exists --- src/phases.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/phases.ts b/src/phases.ts index c87c6e7c2..ef15b52c8 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -144,17 +144,19 @@ export class TitlePhase extends Phase { this.scene.fadeOutBgm(0, false); this.scene.gameData.getSession(loggedInUser.lastSessionSlot).then(sessionData => { - this.lastSessionData = sessionData; - const biomeKey = getBiomeKey(sessionData.arena.biome); - const bgTexture = `${biomeKey}_bg`; - this.scene.arenaBg.setTexture(bgTexture); + if (sessionData) { + this.lastSessionData = sessionData; + const biomeKey = getBiomeKey(sessionData.arena.biome); + const bgTexture = `${biomeKey}_bg`; + this.scene.arenaBg.setTexture(bgTexture); + } this.showOptions(); }); } showOptions(): void { const options: OptionSelectItem[] = []; - if (loggedInUser?.lastSessionSlot > -1) { + if (this.lastSessionData) { options.push({ label: 'Continue', handler: () => this.loadSaveSlot(-1)