Update get_game_by_id() to check for game.id

There were cases where running_games objects didn't have `id` properties, running into python errors. Checking to ensure the property exists first keeps it from breaking.
This commit is contained in:
Rob Loach 2019-01-12 16:13:46 -05:00 committed by GitHub
parent 271fe36efa
commit 70ae81866b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -374,7 +374,7 @@ class Application(Gtk.Application):
def get_game_by_id(self, game_id):
for game in self.running_games:
if game.id == game_id:
if hasattr(game, 'id') and game.id == game_id:
return game
@staticmethod