diff --git a/public/static/js/game.js b/public/static/js/game.js index e8dce36..b52292d 100644 --- a/public/static/js/game.js +++ b/public/static/js/game.js @@ -410,6 +410,10 @@ MapGuesser.showModalWithContent('Error', 'This game is already started, you cannot join.'); break; + case 'game_not_found': + MapGuesser.showModalWithContent('Error', 'The game room was not found by this ID. Please check the link.'); + break; + default: MapGuesser.showModalWithContent('Error', 'Error code: \'' + error + '\''); break diff --git a/src/Controller/GameController.php b/src/Controller/GameController.php index ba4b368..a487644 100644 --- a/src/Controller/GameController.php +++ b/src/Controller/GameController.php @@ -114,6 +114,11 @@ class GameController } $room = $this->multiRoomRepository->getByRoomId($roomId); + + if(!isset($room)) { + return new JsonContent(['error' => 'game_not_found']); + } + $state = $room->getStateArray(); $map = $this->mapRepository->getById($state['mapId']); $token = $this->getMultiToken($roomId);