Ignore non-object prefs JSON (#1257)

This commit is contained in:
red person
2026-06-03 08:12:45 +03:00
committed by GitHub
parent 84d54d9853
commit ba6da17a92
2 changed files with 22 additions and 1 deletions
+2 -1
View File
@@ -12,7 +12,8 @@ def _load():
"""Load the raw prefs file (internal use only)."""
try:
with open(PREFS_FILE, "r", encoding="utf-8") as f:
return json.load(f)
data = json.load(f)
return data if isinstance(data, dict) else {}
except (FileNotFoundError, json.JSONDecodeError):
return {}