Fix crashing issue in led_indicator
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: Ie46124e2a1a4ae5275cfa7cd82ad060bfed48179
diff --git a/y2023/control_loops/superstructure/led_indicator.cc b/y2023/control_loops/superstructure/led_indicator.cc
index 68e7f14..48bca1b 100644
--- a/y2023/control_loops/superstructure/led_indicator.cc
+++ b/y2023/control_loops/superstructure/led_indicator.cc
@@ -73,6 +73,7 @@
superstructure_position_fetcher_.Fetch();
server_statistics_fetcher_.Fetch();
drivetrain_output_fetcher_.Fetch();
+ drivetrain_status_fetcher_.Fetch();
client_statistics_fetcher_.Fetch();
gyro_reading_fetcher_.Fetch();
localizer_output_fetcher_.Fetch();
@@ -165,7 +166,8 @@
}
// Check if there is a target that is in sight
- if (drivetrain_status_fetcher_->line_follow_logging()->have_target()) {
+ if (drivetrain_status_fetcher_.get() != nullptr &&
+ drivetrain_status_fetcher_->line_follow_logging()->have_target()) {
DisplayLed(255, 165, 0);
return;
}