From a6bb2e3c3c832b16eb44355eb8c9e6d1cdc2274d Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 4 Jan 2019 10:12:35 +0100 Subject: [PATCH] Check for nullptr in WallTimer::hasStarted() and SteadyTimer::hasStarted() Analogous to fe9479cdbf0be0caa542c74c7c1fb8229ea8164d (ros/ros_comm#1541). --- clients/roscpp/include/ros/steady_timer.h | 4 ++-- clients/roscpp/include/ros/wall_timer.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clients/roscpp/include/ros/steady_timer.h b/clients/roscpp/include/ros/steady_timer.h index 866eae110a..c98359764f 100644 --- a/clients/roscpp/include/ros/steady_timer.h +++ b/clients/roscpp/include/ros/steady_timer.h @@ -71,9 +71,9 @@ class ROSCPP_DECL SteadyTimer */ void setPeriod(const WallDuration& period, bool reset=true); - bool hasStarted() const { return impl_->hasStarted(); } + bool hasStarted() const { return impl_ && impl_->hasStarted(); } bool isValid() { return impl_ && impl_->isValid(); } - operator void*() { return isValid() ? (void *) 1 : (void *) 0; } + operator void*() { return isValid() ? (void*)1 : (void*)0; } bool operator<(const SteadyTimer& rhs) { diff --git a/clients/roscpp/include/ros/wall_timer.h b/clients/roscpp/include/ros/wall_timer.h index c25c829787..652e79ae97 100644 --- a/clients/roscpp/include/ros/wall_timer.h +++ b/clients/roscpp/include/ros/wall_timer.h @@ -71,7 +71,7 @@ class ROSCPP_DECL WallTimer */ void setPeriod(const WallDuration& period, bool reset=true); - bool hasStarted() const { return impl_->hasStarted(); } + bool hasStarted() const { return impl_ && impl_->hasStarted(); } bool isValid() { return impl_ && impl_->isValid(); } operator void*() { return isValid() ? (void*)1 : (void*)0; }