forked from test/mau_mau_bot
catch error when trying to join ended game
This commit is contained in:
parent
daa211b692
commit
b17dcf5cdc
1 changed files with 7 additions and 2 deletions
|
@ -33,8 +33,13 @@ class GameManager(object):
|
||||||
return None
|
return None
|
||||||
if user.id not in self.userid_game or \
|
if user.id not in self.userid_game or \
|
||||||
self.userid_game[user.id] is not game:
|
self.userid_game[user.id] is not game:
|
||||||
|
|
||||||
|
try:
|
||||||
self.leave_game(user)
|
self.leave_game(user)
|
||||||
player = Player(game, user)
|
player = Player(game, user)
|
||||||
|
except AttributeError:
|
||||||
|
return None
|
||||||
|
|
||||||
self.userid_player[user.id] = player
|
self.userid_player[user.id] = player
|
||||||
self.userid_game[user.id] = game
|
self.userid_game[user.id] = game
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue