Skip to content

Commit

Permalink
Fix SimpleActionServer nullprt callback (#4025)
Browse files Browse the repository at this point in the history
* add check before calling completion_callback_

* Fix lint
  • Loading branch information
BriceRenaudeau authored Dec 21, 2023
1 parent 3992eb1 commit d04de4e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nav2_util/include/nav2_util/simple_action_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class SimpleActionServer
node_logging_interface_->get_logger(),
"Action server failed while executing action callback: \"%s\"", ex.what());
terminate_all();
completion_callback_();
if (completion_callback_) {completion_callback_();}
return;
}

Expand All @@ -254,14 +254,14 @@ class SimpleActionServer
if (stop_execution_) {
warn_msg("Stopping the thread per request.");
terminate_all();
completion_callback_();
if (completion_callback_) {completion_callback_();}
break;
}

if (is_active(current_handle_)) {
warn_msg("Current goal was not completed successfully.");
terminate(current_handle_);
completion_callback_();
if (completion_callback_) {completion_callback_();}
}

if (is_active(pending_handle_)) {
Expand Down Expand Up @@ -314,7 +314,7 @@ class SimpleActionServer
info_msg("Waiting for async process to finish.");
if (steady_clock::now() - start_time >= server_timeout_) {
terminate_all();
completion_callback_();
if (completion_callback_) {completion_callback_();}
throw std::runtime_error("Action callback is still running and missed deadline to stop");
}
}
Expand Down

0 comments on commit d04de4e

Please sign in to comment.