diff --git a/rclcpp/src/rclcpp/clock.cpp b/rclcpp/src/rclcpp/clock.cpp index f21c353a1d..0aaa0c86bc 100644 --- a/rclcpp/src/rclcpp/clock.cpp +++ b/rclcpp/src/rclcpp/clock.cpp @@ -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 {