only read if it's *not* empty

This commit is contained in:
Khaleel Al-Adhami 2024-10-11 16:22:27 -07:00
parent 1eb92fa39b
commit ae1e9358f1

View File

@ -218,7 +218,7 @@ def update_json_file(file_path: str | Path, update_dict: dict[str, int | str]):
# Read the existing json object from the file. # Read the existing json object from the file.
json_object = {} json_object = {}
if fp.stat().st_size == 0: if fp.stat().st_size:
with open(fp) as f: with open(fp) as f:
json_object = json.load(f) json_object = json.load(f)