[commands] Fix RepeatCommand calling end() twice (#5261)

This commit is contained in:
Joseph Eng
2023-04-28 20:57:33 -07:00
committed by GitHub
parent 9cbeb841f5
commit 40ca094686
4 changed files with 82 additions and 44 deletions

View File

@@ -39,7 +39,12 @@ bool RepeatCommand::IsFinished() {
}
void RepeatCommand::End(bool interrupted) {
m_command->End(interrupted);
// Make sure we didn't already call end() (which would happen if the command
// finished in the last call to our execute())
if (!m_ended) {
m_command->End(interrupted);
m_ended = true;
}
}
bool RepeatCommand::RunsWhenDisabled() const {