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:
Peter Johnson
2019-11-01 23:42:01 -07:00
committed by GitHub
parent 1d695a1660
commit 2b6811eddb

View File

@@ -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()});
}
}