From 54346896b9a82dab2e781be71c1f9abaa7772574 Mon Sep 17 00:00:00 2001 From: _Bastler <_Bastler@bstly.de> Date: Mon, 20 Sep 2021 09:53:25 +0200 Subject: [PATCH] fix --- front/src/Connexion/ConnectionManager.ts | 1 + front/src/Phaser/Game/GameScene.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/front/src/Connexion/ConnectionManager.ts b/front/src/Connexion/ConnectionManager.ts index 7cc4c1d5..eba6f563 100644 --- a/front/src/Connexion/ConnectionManager.ts +++ b/front/src/Connexion/ConnectionManager.ts @@ -178,6 +178,7 @@ class ConnectionManager { } catch (e) { console.error(e); localUserStore.setLastRoomUrl(null); + this._currentRoom = null; } if (this._currentRoom != undefined && this._currentRoom.textures != undefined && this._currentRoom.textures.length > 0) { //check if texture was changed diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 20316594..619ad9ed 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -456,6 +456,12 @@ export class GameScene extends DirtyScene { //initialise map this.Map = this.add.tilemap(this.MapUrlFile); const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf("/")); + + if (!this.mapFile) { + localUserStore.setLastRoomUrl(null); + throw new Error("invalid map"); + } + this.mapFile.tilesets.forEach((tileset: ITiledTileSet) => { this.Terrains.push( this.Map.addTilesetImage(