From 593dfd97a0efe3f3056b9f3b981301512fad0b20 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Thu, 3 Jul 2025 11:06:44 +0300 Subject: Add null check for cursor.fetchone() in apply_change function. Signed-off-by: Munyoki Kilyungi --- gn3/db/case_attributes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gn3/db/case_attributes.py') diff --git a/gn3/db/case_attributes.py b/gn3/db/case_attributes.py index 46c4480..421b012 100644 --- a/gn3/db/case_attributes.py +++ b/gn3/db/case_attributes.py @@ -316,7 +316,10 @@ def apply_change(cursor, change_type: EditStatus, change_id: int, directory: Pat "id = %s", (change_id,) ) - json_diff_data, _ = cursor.fetchone() + result = cursor.fetchone() + if result is None: + return False + json_diff_data = result[0] json_diff_data = json.loads(json_diff_data) inbredset_id = json_diff_data.get("inbredset_id") modifications = json_diff_data.get( -- cgit 1.4.1