Fix unreachable code in loop.py and iteration.py

Co-authored-by: JinHai-CN <33142505+JinHai-CN@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-06 02:18:09 +00:00
parent 22f17f6334
commit a0a7eb9100
2 changed files with 24 additions and 28 deletions

View File

@ -57,9 +57,7 @@ class Iteration(ComponentBase, ABC):
return cid return cid
def _invoke(self, **kwargs): def _invoke(self, **kwargs):
if self.check_if_canceled("Iteration processing"): if not self.check_if_canceled("Iteration processing"):
return
arr = self._canvas.get_variable_value(self._param.items_ref) arr = self._canvas.get_variable_value(self._param.items_ref)
if not isinstance(arr, list): if not isinstance(arr, list):
self.set_output("_ERROR", self._param.items_ref + " must be an array, but its type is "+str(type(arr))) self.set_output("_ERROR", self._param.items_ref + " must be an array, but its type is "+str(type(arr)))

View File

@ -51,9 +51,7 @@ class Loop(ComponentBase, ABC):
return cid return cid
def _invoke(self, **kwargs): def _invoke(self, **kwargs):
if self.check_if_canceled("Loop processing"): if not self.check_if_canceled("Loop processing"):
return
for item in self._param.loop_variables: for item in self._param.loop_variables:
if any([not item.get("variable"), not item.get("input_mode"), not item.get("value"),not item.get("type")]): if any([not item.get("variable"), not item.get("input_mode"), not item.get("value"),not item.get("type")]):
assert "Loop Variable is not complete." assert "Loop Variable is not complete."