Attempt to fix cppcheck (#646)

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
This commit is contained in:
Shane Loretz 2019-03-04 11:11:07 -08:00 committed by GitHub
parent 3919ab1897
commit c51b28420f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -130,10 +130,15 @@ Clock::create_jump_callback(
rclcpp::Clock::on_time_jump, handler);
if (RCL_RET_OK != ret) {
delete handler;
handler = NULL;
handler = nullptr;
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*
// create shared_ptr that removes the callback automatically when all copies are destructed
return rclcpp::JumpHandler::SharedPtr(handler, [this](rclcpp::JumpHandler * handler) noexcept {