Skip to content

Commit

Permalink
Prevent crash if .patched files are empty or corrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
lah7 committed Sep 4, 2024
1 parent cea0fff commit 44acecd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions sims2patcher/gamefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,14 @@ def read_meta_file(self):
return

self.patched = True
self.patched_version = float(config.get("patch", "version"))
try:
self.patch_version = float(config.get("patch", "version"))
self.compressed = config.getboolean("patch", "compressed")
self.scale = config.getfloat("patch", "scale")
self.upscale_filter = config.getint("patch", "upscale_filter")
except (configparser.NoOptionError, configparser.NoSectionError):
self.patch_version = 0.0

self.compressed = config.getboolean("patch", "compressed")
self.scale = config.getfloat("patch", "scale")
self.upscale_filter = config.getint("patch", "upscale_filter")
self.outdated = self.patch_version < FILE_PATCH_VERSION

def write_meta_file(self):
Expand Down

0 comments on commit 44acecd

Please sign in to comment.