From edaeec923d1ca54341afc564363a1d1d6f9e1664 Mon Sep 17 00:00:00 2001 From: Wouter Wijsman Date: Fri, 11 Aug 2023 11:21:50 +0200 Subject: [PATCH] Create new config if reading it fails --- CHANGELOG.md | 1 + minigalaxy/config.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 078e46b4..59405a26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Add category filtering dialog for game library (thanks to orende) - Parallelize api.can_connect function with threads, futures (thanks to orende) - Fix available disk space being checked in parent directory (thanks to Unrud) +- Create new config if reading it fails **1.2.2** - Fix progress bar not showing up for downloads diff --git a/minigalaxy/config.py b/minigalaxy/config.py index 876b47ad..7512b3de 100644 --- a/minigalaxy/config.py +++ b/minigalaxy/config.py @@ -21,7 +21,7 @@ def __load(self) -> None: with open(self.__config_file, "r") as file: try: self.__config = json.loads(file.read()) - except json.decoder.JSONDecodeError: + except (json.decoder.JSONDecodeError, UnicodeDecodeError): logger.warn("Reading config.json failed, creating new config file.") os.remove(self.__config_file)