Raise error if loading a JSON fails
Don't use the default config if there's an error in a JSON config file, a single typo could lead to an entire user settings file getting overwritten by default data.
This commit is contained in:
parent
75fbf23b21
commit
6ce3059322
|
@ -188,11 +188,7 @@ class JSONFile(MappingFile):
|
|||
returned dict and the second tuple item will be `True`.
|
||||
"""
|
||||
|
||||
try:
|
||||
loaded = json.loads(data)
|
||||
except json.JSONDecodeError:
|
||||
loaded = {}
|
||||
|
||||
loaded = json.loads(data)
|
||||
all_data = self.default_data.copy()
|
||||
dict_update_recursive(all_data, loaded)
|
||||
return (all_data, loaded != all_data)
|
||||
|
|
Loading…
Reference in New Issue
Block a user