Handle errors when loading games from disk

This commit is contained in:
kramo
2023-08-16 12:45:32 +02:00
parent 73897a9ed3
commit 0d6432388c

View File

@@ -144,7 +144,10 @@ class CartridgesApplication(Adw.Application):
def load_games_from_disk(self):
if shared.games_dir.is_dir():
for game_file in shared.games_dir.iterdir():
data = json.load(game_file.open())
try:
data = json.load(game_file.open())
except (OSError, json.decoder.JSONDecodeError):
continue
game = Game(data)
shared.store.add_game(game, {"skip_save": True})