From 6a7c9b3aab50e28b167f34ed6b2c7093005f282a Mon Sep 17 00:00:00 2001 From: klemek Date: Sat, 16 May 2026 18:10:31 +0200 Subject: [PATCH] fix: bound timer counter to uint max on fail --- src/timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/timer.c b/src/timer.c index 3016dc9..e664f30 100644 --- a/src/timer.c +++ b/src/timer.c @@ -1,3 +1,4 @@ +#include #include #include "types.h" @@ -12,7 +13,7 @@ void timer_init(Timer *timer, const unsigned int target) { bool timer_inc(Timer *timer) { timer->counter += 1; - return timer->counter >= timer->target; + return timer->counter == UINT_MAX || timer->counter >= timer->target; } double timer_reset(Timer *timer) {