From c51b28420f354b890f3605fcf33651d0b3598a45 Mon Sep 17 00:00:00 2001 From: Shane Loretz Date: Mon, 4 Mar 2019 11:11:07 -0800 Subject: [PATCH] Attempt to fix cppcheck (#646) 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 {