From 574b080d69b2b968cfe871bc7cfe8fdf930fbc2e Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Tue, 5 Nov 2019 13:47:53 +0100 Subject: [PATCH] core: slow timer - warning message if callback function is null --- src/core/timer.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/core/timer.c b/src/core/timer.c index 1bcd036fda1..f6b60ec3df0 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -1101,7 +1101,19 @@ void slow_timer_main() #endif SET_RUNNING_SLOW(tl); UNLOCK_SLOW_TIMER_LIST(); - ret=tl->f(*ticks, tl, tl->data); + if(likely(tl->f)) { + ret=tl->f(*ticks, tl, tl->data); + } else { + ret =0; +#ifdef TIMER_DEBUG + LM_WARN("null timer callback for %p (%s:%u - %s(...))\n", + tl, (tl->add_file)?tl->add_file:"unknown", + tl->add_line, + (tl->add_func)?tl->add_func:"unknown"); +#else + LM_WARN("null callback function for %p\n", tl); +#endif + } /* reset the configuration group handles */ cfg_reset_all(); if (ret==0){