From de24ee81577985a1d1aa9833b20a462a6867ce38 Mon Sep 17 00:00:00 2001 From: derrod Date: Wed, 1 Dec 2021 21:11:53 +0100 Subject: [PATCH] [cli] Do not crash if DLC is missing metadata for some reason Fixes #371 --- legendary/cli.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/legendary/cli.py b/legendary/cli.py index 637a187..b3fc5fa 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -290,6 +290,10 @@ class LegendaryCLI: continue games.remove(game) dlc = self.core.get_game(game.app_name) + if not dlc or not dlc.metadata: + logger.warning(f'DLC "{game.app_name}" is missing metadata for some reason. ' + f'Running "legendary list-games" may fix this.') + continue main_app_name = dlc.metadata['mainGameItem']['releaseInfo'][0]['appId'] installed_dlcs[main_app_name].append(game) @@ -438,6 +442,9 @@ class LegendaryCLI: # evaluate current save state for each game. for igame in igames: + if not igame.platform.startswith('Win'): + continue + game = self.core.get_game(igame.app_name) if not game or not game.supports_cloud_saves: if igame.app_name in latest_save: