diff --git a/astrbot/core/utils/shared_preferences.py b/astrbot/core/utils/shared_preferences.py index b11987322..fc0bf7434 100644 --- a/astrbot/core/utils/shared_preferences.py +++ b/astrbot/core/utils/shared_preferences.py @@ -8,9 +8,11 @@ class SharedPreferences: self._data = self._load_preferences() def _load_preferences(self): - if os.path.exists(self.path): + try: with open(self.path, "r") as f: return json.load(f) + except json.JSONDecodeError: + os.remove(self.path) return {} def _save_preferences(self):