Skip to content

Commit

Permalink
Fix SEGV caused by goal_handle_ which is nullptr while result_callbac…
Browse files Browse the repository at this point in the history
…k called (#2356)

* Fix SEGV caused by goal_handle_ which is nullptr while result_callback called

* Ignoring the goal result if a new goal request sent
  • Loading branch information
KavenYau authored May 29, 2021
1 parent c2bc550 commit c009b04
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,14 @@ class BtActionNode : public BT::ActionNodeBase
auto send_goal_options = typename rclcpp_action::Client<ActionT>::SendGoalOptions();
send_goal_options.result_callback =
[this](const typename rclcpp_action::ClientGoalHandle<ActionT>::WrappedResult & result) {
if (future_goal_handle_) {
RCLCPP_DEBUG(
node_->get_logger(),
"Goal result for %s available, but it hasn't received the goal response yet. "
"It's probably a goal result for the last goal request", action_name_.c_str());
return;
}

// TODO(#1652): a work around until rcl_action interface is updated
// if goal ids are not matched, the older goal call this callback so ignore the result
// if matched, it must be processed (including aborted)
Expand Down

0 comments on commit c009b04

Please sign in to comment.