Fix crash on title when no save data exists

pull/16/head
Flashfyre 2024-03-21 13:17:43 -04:00
parent cf959c6e1b
commit 669260155c
1 changed files with 7 additions and 5 deletions

View File

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