Skip to content

Commit

Permalink
fix(operation mode manager): add nullptr check in onTimer (#7446)
Browse files Browse the repository at this point in the history
Signed-off-by: Mamoru Sobue <[email protected]>
  • Loading branch information
soblin authored Jun 11, 2024
1 parent f87cf32 commit 36b0b2b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions control/autoware_operation_mode_transition_manager/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,16 @@ void OperationModeTransitionManager::processTransition()

void OperationModeTransitionManager::onTimer()
{
control_mode_report_ = *sub_control_mode_report_.takeData();
gate_operation_mode_ = *sub_gate_operation_mode_.takeData();
const auto control_mode_report_ptr = sub_control_mode_report_.takeData();
if (!control_mode_report_ptr) {
return;
}
const auto gate_operation_mode_ptr = sub_gate_operation_mode_.takeData();
if (!gate_operation_mode_ptr) {
return;
}
control_mode_report_ = *control_mode_report_ptr;
gate_operation_mode_ = *gate_operation_mode_ptr;

for (const auto & [type, mode] : modes_) {
mode->update(current_mode_ == type && transition_);
Expand Down

0 comments on commit 36b0b2b

Please sign in to comment.