handle error if characterLayers are not set

This commit is contained in:
Piotr 'pwh' Hanusiak 2022-04-25 16:53:20 +02:00 committed by David Négrier
parent bc219d0139
commit 85531745c9

View File

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