From c42f63b1bc483bf31dff505abe2f6b3f7904e612 Mon Sep 17 00:00:00 2001 From: Shane Loretz Date: Mon, 4 Mar 2019 09:55:43 -0800 Subject: [PATCH] Attempt to fix cppcheck Signed-off-by: Shane Loretz --- rclcpp/src/rclcpp/clock.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 {