From 78636207ab47ee1e89109975d43ed42e989d2918 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 25 Feb 2023 14:10:49 -0800 Subject: [PATCH] Treat blank config files as empty dict. --- voussoirkit/configlayers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/voussoirkit/configlayers.py b/voussoirkit/configlayers.py index 976d5b9..653b22e 100644 --- a/voussoirkit/configlayers.py +++ b/voussoirkit/configlayers.py @@ -86,8 +86,11 @@ def load_file(filepath, default_config): needs_rewrite = False if user_config_exists: - with path.open('r', encoding='utf-8') as handle: - user_config = json.load(handle) + content = path.read('r', encoding='utf-8') + if not content.strip(): + user_config = {} + else: + user_config = json.loads(content) (final_config, needs_rewrite) = layer_json(target=final_config, supply=user_config) else: needs_rewrite = True