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 <noreply@anthropic.com>
This commit is contained in:
parent
e915d3fb13
commit
0eac40abf6
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user