Skip to content

Commit bd15f2f

Browse files
author
vicmassy
committed
Fix cancel goal with emopty goal handle
1 parent ce923e1 commit bd15f2f

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

Lines changed: 6 additions & 0 deletions
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)