From 66f55a7d7c10e2c31c868b9b2a95790732d6a18c Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Sun, 28 Dec 2025 02:59:51 -0800 Subject: [PATCH] Better data handling --- modules/json_helpers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/json_helpers.py b/modules/json_helpers.py index 5cb495437..600f5fc8c 100644 --- a/modules/json_helpers.py +++ b/modules/json_helpers.py @@ -59,13 +59,15 @@ def readfile(filename: str, silent: bool = False, lock: bool = False, *, as_type except Exception: locking_available = False if isinstance(data, list) and as_type == "dict": - log.warning(f"Read: Expected dictionary from '{filename}' but got list") + if not data: + return {} data0 = data[0] if isinstance(data0, dict): return data0 return {} if isinstance(data, dict) and as_type == "list": - log.warning(f"Read: Expected list from '{filename}' but got dictionary") + if not data: + return [] return [data] return data