Skip to content

Commit

Permalink
Fix SequentialCommandGroup.end logic to match Java
Browse files Browse the repository at this point in the history
- self._currentCommandIndex must always be set to -1 in end
  • Loading branch information
virtuald committed Jan 20, 2024
1 parent b0b514f commit d280859
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions commands2/sequentialcommandgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,13 @@ def execute(self):
self._commands[self._currentCommandIndex].initialize()

def end(self, interrupted: bool):
if not interrupted:
return
if not self._commands:
return
if not self._currentCommandIndex > -1:
return
if not self._currentCommandIndex < len(self._commands):
return
if (
interrupted
and self._commands
and -1 < self._currentCommandIndex < len(self._commands)
):
self._commands[self._currentCommandIndex].end(True)

self._commands[self._currentCommandIndex].end(True)
self._currentCommandIndex = -1

def isFinished(self) -> bool:
Expand Down

0 comments on commit d280859

Please sign in to comment.