From 26fda9cd1fa850901612dda2e23ddc588a6d36b2 Mon Sep 17 00:00:00 2001 From: Ari Fogel Date: Mon, 7 Oct 2024 22:42:37 -0700 Subject: [PATCH] Fix FF7 remake crash when no mods are selected In function `_active_mod_mappings`, `pak_priority_digits` was calculated based on log base 10 of number of mod paths for selected mods. When no mods are selected (or no paths present in selected mods), this takes log(0) resulting in a ValueError. But no `pak_priority_digits` is needed in this case, so this commit fixes by early exiting in case of no mod paths prior to computing `pak_priority_digits`. --- games/game_finalfantasy7remake.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/games/game_finalfantasy7remake.py b/games/game_finalfantasy7remake.py index e37fafc..44dd74f 100644 --- a/games/game_finalfantasy7remake.py +++ b/games/game_finalfantasy7remake.py @@ -47,6 +47,8 @@ def _active_mod_paths(self) -> Iterable[Path]: yield mods_parent_path / mod def _active_mod_mappings(self, mod_paths: List[Path]) -> Iterable[mobase.Mapping]: + if not mod_paths: + return pak_priority_digits = math.floor(math.log10(len(mod_paths))) + 1 for priority, mod_path in enumerate(mod_paths):