Skip to content

Commit

Permalink
Attempt to fix cppcheck (#646)
Browse files Browse the repository at this point in the history
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
  • Loading branch information
sloretz committed Mar 4, 2019
1 parent 3919ab1 commit c51b284
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rclcpp/src/rclcpp/clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c51b284

Please sign in to comment.