From b17dcf5cdc1e8b8ae4cbefd197be0f05257567a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Tue, 19 Apr 2016 00:42:23 +0200 Subject: [PATCH] catch error when trying to join ended game --- game_manager.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/game_manager.py b/game_manager.py index 514a6c7..502583c 100644 --- a/game_manager.py +++ b/game_manager.py @@ -33,8 +33,13 @@ class GameManager(object): return None if user.id not in self.userid_game or \ self.userid_game[user.id] is not game: - self.leave_game(user) - player = Player(game, user) + + try: + self.leave_game(user) + player = Player(game, user) + except AttributeError: + return None + self.userid_player[user.id] = player self.userid_game[user.id] = game return True