Skip to content

Commit f42d637

Browse files
committed
[cli] Fix crash when not installing
1 parent 1226cd1 commit f42d637

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

legendary/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ def install_game(self, args):
614614
if not analysis.dl_size:
615615
old_igame = self.core.get_installed_game(game.app_name)
616616
logger.info('Download size is 0, the game is either already up to date or has not changed. Exiting...')
617-
if args.repair_mode and os.path.exists(repair_file):
617+
if old_igame and args.repair_mode and os.path.exists(repair_file):
618618
if old_igame.needs_verification:
619619
old_igame.needs_verification = False
620620
self.core.install_game(old_igame)
@@ -623,7 +623,7 @@ def install_game(self, args):
623623
os.remove(repair_file)
624624

625625
# check if install tags have changed, if they did; try deleting files that are no longer required.
626-
if old_igame.install_tags != igame.install_tags:
626+
if old_igame and old_igame.install_tags != igame.install_tags:
627627
old_igame.install_tags = igame.install_tags
628628
self.logger.info('Deleting now untagged files.')
629629
self.core.uninstall_tag(old_igame)
@@ -717,7 +717,7 @@ def install_game(self, args):
717717
logger.info(f'To download saves for this game run "legendary sync-saves {args.app_name}"')
718718

719719
old_igame = self.core.get_installed_game(game.app_name)
720-
if args.repair_mode and os.path.exists(repair_file):
720+
if old_igame and args.repair_mode and os.path.exists(repair_file):
721721
if old_igame.needs_verification:
722722
old_igame.needs_verification = False
723723
self.core.install_game(old_igame)
@@ -726,7 +726,7 @@ def install_game(self, args):
726726
os.remove(repair_file)
727727

728728
# check if install tags have changed, if they did; try deleting files that are no longer required.
729-
if old_igame.install_tags != igame.install_tags:
729+
if old_igame and old_igame.install_tags != igame.install_tags:
730730
old_igame.install_tags = igame.install_tags
731731
self.logger.info('Deleting now untagged files.')
732732
self.core.uninstall_tag(old_igame)

0 commit comments

Comments
 (0)