Skip to content

Commit b82d850

Browse files
Merge pull request #53 from umdlife/main_umd
Fix cancel goal with empty goal handle
2 parents ce923e1 + bd15f2f commit b82d850

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

behaviortree_ros2/include/behaviortree_ros2/bt_action_node.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,12 @@ template<class T> inline
433433
template<class T> inline
434434
void RosActionNode<T>::cancelGoal()
435435
{
436+
if (!goal_handle_)
437+
{
438+
RCLCPP_WARN( node_->get_logger(), "cancelGoal called on an empty goal_handle");
439+
return;
440+
}
441+
436442
auto future_result = action_client_->async_get_result(goal_handle_);
437443
auto future_cancel = action_client_->async_cancel_goal(goal_handle_);
438444

0 commit comments

Comments
 (0)