fix: Add None-check for Logic-Node condition/expression
All checks were successful
Deploy Development / deploy (push) Successful in 51s
Build Test / pytest-backend (push) Successful in 4s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 16s

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:
Lars 2026-04-13 08:32:54 +02:00
parent e915d3fb13
commit 0eac40abf6

View File

@ -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,