diff --git a/src/system/SystemTimer.h b/src/system/SystemTimer.h index 698be028ce029a..99c3d8620f194f 100644 --- a/src/system/SystemTimer.h +++ b/src/system/SystemTimer.h @@ -204,7 +204,11 @@ class TimerPool Timer * Create(Layer & systemLayer, System::Clock::Timestamp awakenTime, TimerCompleteCallback onComplete, void * appState) { Timer * timer = mTimerPool.CreateObject(systemLayer, awakenTime, onComplete, appState); - SYSTEM_STATS_INCREMENT(Stats::kSystemLayer_NumTimers); + if (timer != nullptr) + { + SYSTEM_STATS_INCREMENT(Stats::kSystemLayer_NumTimers); + } + return timer; }