mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Fix null pointer dereference in C++ CommandScheduler (#2023)
Java has a null check that was missing in C++ when adding default commands.
This commit is contained in:
@@ -174,7 +174,7 @@ void CommandScheduler::Run() {
|
||||
// Add default commands for un-required registered subsystems.
|
||||
for (auto&& subsystem : m_subsystems) {
|
||||
auto s = m_requirements.find(subsystem.getFirst());
|
||||
if (s == m_requirements.end()) {
|
||||
if (s == m_requirements.end() && subsystem.getSecond()) {
|
||||
Schedule({subsystem.getSecond().get()});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user