Skip to content

Commit

Permalink
Add handling in case the playtime in the config .yml for a game is ga…
Browse files Browse the repository at this point in the history
…rbage; this will log and reset the playtime to 0.

Resolves #5476
  • Loading branch information
danieljohnson2 committed May 14, 2024
1 parent 87b18f2 commit f8468e1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lutris/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ def __init__(self, game_id: str = None):
self.custom_images.add("coverart_big")
self.service = game_data.get("service")
self.appid = game_data.get("service_id")
self.playtime = float(game_data.get("playtime") or 0.0)
try:
self.playtime = float(game_data.get("playtime") or 0.0)
except ValueError as ex:
logger.exception("Unable to parse playtime '%s' for game %s: %s", game_data.get("playtime"), self.slug, ex)
self.playtime = 0.0

self.discord_id = game_data.get("discord_id") # Discord App ID for RPC

self._config = None
Expand Down

0 comments on commit f8468e1

Please sign in to comment.