Attempt to fix cppcheck (#646)
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
This commit is contained in:
parent
3919ab1897
commit
c51b28420f
1 changed files with 6 additions and 1 deletions
|
@ -130,10 +130,15 @@ Clock::create_jump_callback(
|
||||||
rclcpp::Clock::on_time_jump, handler);
|
rclcpp::Clock::on_time_jump, handler);
|
||||||
if (RCL_RET_OK != ret) {
|
if (RCL_RET_OK != ret) {
|
||||||
delete handler;
|
delete handler;
|
||||||
handler = NULL;
|
handler = nullptr;
|
||||||
rclcpp::exceptions::throw_from_rcl_error(ret, "Failed to add time jump callback");
|
rclcpp::exceptions::throw_from_rcl_error(ret, "Failed to add time jump callback");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nullptr == handler) {
|
||||||
|
// imposible to reach here; added to make cppcheck happy
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// *INDENT-OFF*
|
// *INDENT-OFF*
|
||||||
// create shared_ptr that removes the callback automatically when all copies are destructed
|
// create shared_ptr that removes the callback automatically when all copies are destructed
|
||||||
return rclcpp::JumpHandler::SharedPtr(handler, [this](rclcpp::JumpHandler * handler) noexcept {
|
return rclcpp::JumpHandler::SharedPtr(handler, [this](rclcpp::JumpHandler * handler) noexcept {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue