only read if it's *not* empty (#4165)

This commit is contained in:
Khaleel Al-Adhami 2024-10-11 16:49:01 -07:00 committed by GitHub
parent 1eb92fa39b
commit 0311dae568
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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.
json_object = {}
if fp.stat().st_size == 0:
if fp.stat().st_size:
with open(fp) as f:
json_object = json.load(f)