From 8dcd05dbb2e93d408303f2a511397a83bb86803f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Thu, 2 Jun 2016 15:36:40 +0200 Subject: [PATCH] kind-of bugfix for duplicate players --- game_manager.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/game_manager.py b/game_manager.py index 780e629..416096f 100644 --- a/game_manager.py +++ b/game_manager.py @@ -144,10 +144,20 @@ class GameManager(object): pass if this_users_players: - self.userid_current[player_in_game.user.id] = this_users_players[0] + try: + self.userid_current[player_in_game.user.id] = this_users_players[0] + except KeyError: + pass else: - del self.userid_players[player_in_game.user.id] - del self.userid_current[player_in_game.user.id] + try: + del self.userid_players[player_in_game.user.id] + except KeyError: + pass + + try: + del self.userid_current[player_in_game.user.id] + except KeyError: + pass self.chatid_games[chat.id].remove(game) if not self.chatid_games[chat.id]: