Skip to content

Commit

Permalink
fix(document_extractor): handle empty variable values properly
Browse files Browse the repository at this point in the history
- Added check for variable.value existence before type validation.
- Prevents erroneous type checks on empty variables, improving robustness.
  • Loading branch information
laipz8200 committed Sep 30, 2024
1 parent 3821a28 commit 7911105
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _run(self):
if variable is None:
error_message = f"File variable not found for selector: {variable_selector}"
return NodeRunResult(status=WorkflowNodeExecutionStatus.FAILED, error=error_message)
if not isinstance(variable, ArrayFileSegment | FileSegment):
if variable.value and not isinstance(variable, ArrayFileSegment | FileSegment):
error_message = f"Variable {variable_selector} is not an ArrayFileSegment"
return NodeRunResult(status=WorkflowNodeExecutionStatus.FAILED, error=error_message)

Expand Down

0 comments on commit 7911105

Please sign in to comment.