Skip to content

Commit

Permalink
daemon: Also handle UnicodeDecodeError for persistence file fail
Browse files Browse the repository at this point in the history
Fixes #2240
  • Loading branch information
z3ntu committed Apr 29, 2024
1 parent 1c5e975 commit 72db40b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion daemon/openrazer_daemon/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def read_persistence(self, persistence_file):
if persistence_file is not None and os.path.exists(persistence_file):
try:
self._persistence.read(persistence_file)
except configparser.Error:
except (configparser.Error, UnicodeDecodeError):
self.logger.warning('Failed to read persistence config, resetting!', exc_info=True)
with open(persistence_file, "w") as f:
f.writelines("")
Expand Down

0 comments on commit 72db40b

Please sign in to comment.