Skip to content

Commit

Permalink
Check for nullptr in WallTimer::hasStarted() and SteadyTimer::hasStar…
Browse files Browse the repository at this point in the history
…ted()

Analogous to fe9479c (#1541).
  • Loading branch information
meyerj committed Jan 4, 2019
1 parent eb4e9b3 commit a6bb2e3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions clients/roscpp/include/ros/steady_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion clients/roscpp/include/ros/wall_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down

0 comments on commit a6bb2e3

Please sign in to comment.