Treat blank config files as empty dict.
This commit is contained in:
parent
65d0f6f4d1
commit
78636207ab
1 changed files with 5 additions and 2 deletions
|
@ -86,8 +86,11 @@ def load_file(filepath, default_config):
|
||||||
needs_rewrite = False
|
needs_rewrite = False
|
||||||
|
|
||||||
if user_config_exists:
|
if user_config_exists:
|
||||||
with path.open('r', encoding='utf-8') as handle:
|
content = path.read('r', encoding='utf-8')
|
||||||
user_config = json.load(handle)
|
if not content.strip():
|
||||||
|
user_config = {}
|
||||||
|
else:
|
||||||
|
user_config = json.loads(content)
|
||||||
(final_config, needs_rewrite) = layer_json(target=final_config, supply=user_config)
|
(final_config, needs_rewrite) = layer_json(target=final_config, supply=user_config)
|
||||||
else:
|
else:
|
||||||
needs_rewrite = True
|
needs_rewrite = True
|
||||||
|
|
Loading…
Reference in a new issue