From 0eac40abf6c300c0845f9f271ff759ff7014bf7f Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 13 Apr 2026 08:32:54 +0200 Subject: [PATCH] fix: Add None-check for Logic-Node condition/expression Previous fix handled hasattr() but didn't check for None values. Now explicitly checks that operator/expression is not None before using it. Error was: "'NoneType' object has no attribute 'operator'" Clearer error message: "condition is None or missing" Co-Authored-By: Claude Opus 4.6 --- backend/workflow_executor.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/backend/workflow_executor.py b/backend/workflow_executor.py index f1a6638..2d78b68 100644 --- a/backend/workflow_executor.py +++ b/backend/workflow_executor.py @@ -412,12 +412,18 @@ def execute_logic_node( # Handle both serialization formats: # UI format: condition = {operands: [...], operator: "and"} # Expected format: condition = {expression: {operands: [...], operator: "and"}} + expression = None + if hasattr(node.condition, 'operator') and hasattr(node.condition, 'operands'): - expression = node.condition # UI format (direct) - elif hasattr(node.condition, 'expression'): - expression = node.condition.expression # Expected format (wrapped) - else: - error_msg = f"Logic node {node.id} has invalid condition structure (missing operator/operands)" + # UI format (direct) - check that operator is not None + if node.condition.operator is not None: + expression = node.condition + elif hasattr(node.condition, 'expression') and node.condition.expression is not None: + # Expected format (wrapped) - check that expression is not None + expression = node.condition.expression + + if expression is None: + error_msg = f"Logic node {node.id} has invalid or empty condition (operator/operands/expression is None or missing)" logger.error(error_msg) return NodeExecutionState( node_id=node.id,