fix: add check for state file in load_state

This commit is contained in:
2026-02-19 14:25:37 +00:00
parent b7bf04638a
commit 81a7442d7a

View File

@@ -16,7 +16,11 @@ def get_state_file_path() -> Path:
return get_state_dir() / STATE_NAME return get_state_dir() / STATE_NAME
def load_state() -> dict: def load_state() -> dict:
with get_state_file_path().open() as f: path = get_state_file_path()
if not path.exists():
return EMPTY_STATE.copy()
with path.open() as f:
return json.load(f) return json.load(f)
def write_state(state: dict) -> None: def write_state(state: dict) -> None: