Fix crash on title when no save data exists
This commit is contained in:
parent
cf959c6e1b
commit
669260155c
|
@ -144,17 +144,19 @@ export class TitlePhase extends Phase {
|
||||||
this.scene.fadeOutBgm(0, false);
|
this.scene.fadeOutBgm(0, false);
|
||||||
|
|
||||||
this.scene.gameData.getSession(loggedInUser.lastSessionSlot).then(sessionData => {
|
this.scene.gameData.getSession(loggedInUser.lastSessionSlot).then(sessionData => {
|
||||||
this.lastSessionData = sessionData;
|
if (sessionData) {
|
||||||
const biomeKey = getBiomeKey(sessionData.arena.biome);
|
this.lastSessionData = sessionData;
|
||||||
const bgTexture = `${biomeKey}_bg`;
|
const biomeKey = getBiomeKey(sessionData.arena.biome);
|
||||||
this.scene.arenaBg.setTexture(bgTexture);
|
const bgTexture = `${biomeKey}_bg`;
|
||||||
|
this.scene.arenaBg.setTexture(bgTexture);
|
||||||
|
}
|
||||||
this.showOptions();
|
this.showOptions();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
showOptions(): void {
|
showOptions(): void {
|
||||||
const options: OptionSelectItem[] = [];
|
const options: OptionSelectItem[] = [];
|
||||||
if (loggedInUser?.lastSessionSlot > -1) {
|
if (this.lastSessionData) {
|
||||||
options.push({
|
options.push({
|
||||||
label: 'Continue',
|
label: 'Continue',
|
||||||
handler: () => this.loadSaveSlot(-1)
|
handler: () => this.loadSaveSlot(-1)
|
||||||
|
|
Loading…
Reference in New Issue