From f0fdcbffb1b2a1b08ac4856893dd133dce18e84d Mon Sep 17 00:00:00 2001 From: Jiri Sindelar Date: Fri, 5 Sep 2025 17:44:16 +0200 Subject: [PATCH] Handles missing data in workfile entities Ensures that the code gracefully handles cases where the 'data' key is missing or None within the workfile entity. This prevents potential errors and improves the robustness of the workfile processing logic. --- client/ayon_core/host/interfaces/workfiles.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/client/ayon_core/host/interfaces/workfiles.py b/client/ayon_core/host/interfaces/workfiles.py index 93aad4c117..0c03cf4ec6 100644 --- a/client/ayon_core/host/interfaces/workfiles.py +++ b/client/ayon_core/host/interfaces/workfiles.py @@ -1125,8 +1125,11 @@ class IWorkfileHost(AbstractHost): version = comment = None if workfile_entity is not None: _data = workfile_entity["data"] - version = _data.get("version") - comment = _data.get("comment") + version = None + comment = None + if _data is not None: + version = _data.get("version") + comment = _data.get("comment") if version is None: parsed_data = data_parser.parse_data(filename) @@ -1152,8 +1155,11 @@ class IWorkfileHost(AbstractHost): continue _data = workfile_entity["data"] - version = _data.get("version") - comment = _data.get("comment") + version = None + comment = None + if _data is not None: + version = _data.get("version") + comment = _data.get("comment") if version is None: filename = os.path.basename(rootless_path) parsed_data = data_parser.parse_data(filename)