From 85531745c9c9afd7da7a14d93ed37a841148d150 Mon Sep 17 00:00:00 2001
From: Piotr 'pwh' Hanusiak
Date: Mon, 25 Apr 2022 16:53:20 +0200
Subject: [PATCH] handle error if characterLayers are not set
---
front/src/Phaser/Login/CustomizeScene.ts | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/front/src/Phaser/Login/CustomizeScene.ts b/front/src/Phaser/Login/CustomizeScene.ts
index b86358f8..bc08136e 100644
--- a/front/src/Phaser/Login/CustomizeScene.ts
+++ b/front/src/Phaser/Login/CustomizeScene.ts
@@ -94,14 +94,18 @@ export class CustomizeScene extends AbstractCharacterScene {
}
public create(): void {
- const savedWokaLayers = gameManager.getCharacterLayers();
- if (savedWokaLayers && savedWokaLayers.length !== 0) {
- this.selectedLayers = [];
- for (let i = 0; i < savedWokaLayers.length; i += 1) {
- this.selectedLayers.push(
- this.layers[i].findIndex((item) => item.id === gameManager.getCharacterLayers()[i])
- );
+ try {
+ const savedWokaLayers = gameManager.getCharacterLayers();
+ if (savedWokaLayers && savedWokaLayers.length !== 0) {
+ this.selectedLayers = [];
+ for (let i = 0; i < savedWokaLayers.length; i += 1) {
+ this.selectedLayers.push(
+ this.layers[i].findIndex((item) => item.id === gameManager.getCharacterLayers()[i])
+ );
+ }
}
+ } catch (error) {
+ console.warn(error);
}
waScaleManager.zoomModifier = 1;
this.createSlotBackgroundTextures();