[cli] Check for empty list when activating Origin games

Prevents `IndexError` from occurring when Origin games list is empty.
This commit is contained in:
tooru 2022-06-24 13:08:54 +03:00 committed by GitHub
parent fc73c1d4bf
commit 496bda3345
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2013,6 +2013,10 @@ class LegendaryCLI:
na_games, _ = self.core.get_non_asset_library_items(skip_ue=True)
origin_games = [game for game in na_games if game.third_party_store == 'Origin']
if not origin_games:
logger.info('No redeemable games found.')
return
logger.info(f'Found {len(origin_games)} game(s) to redeem:')
for game in origin_games:
logger.info(f' - {game.app_title}')