-
Notifications
You must be signed in to change notification settings - Fork 612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cmd] Fix RepeatCommand calling end() twice #5261
Conversation
Should we add tests for this behavior? |
|
#4576 is about PS4 triangle methods, did you mean a different PR? |
wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/RepeatCommandTest.java
Outdated
Show resolved
Hide resolved
My mistake, I meant #4706. |
There's a few other tests that use |
Don't fix them here. |
Okay, any other changes to make? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Assuming CI passes)
Looks good to me
CI passes |
If the command wrapped by a
RepeatCommand
finished naturally at the same time the repeat command was interrupted,.end()
would be called twice (first.end(false)
and then.end(true)
).This was especially problematic if the wrapped command is a
ProxyCommand
, since the first call to.end()
would set itsm_command
to null and then the second call would attempt to callm_command.cancel()
, resulting in a NPE.