Browse code

core: slow timer - warning message if callback function is null

Daniel-Constantin Mierla authored on 05/11/2019 12:47:53
Showing 1 changed files
... ...
@@ -1101,7 +1101,19 @@ void slow_timer_main()
1101 1101
 #endif
1102 1102
 				SET_RUNNING_SLOW(tl);
1103 1103
 				UNLOCK_SLOW_TIMER_LIST();
1104
-					ret=tl->f(*ticks, tl, tl->data);
1104
+					if(likely(tl->f)) {
1105
+						ret=tl->f(*ticks, tl, tl->data);
1106
+					} else {
1107
+						ret =0;
1108
+#ifdef TIMER_DEBUG
1109
+						LM_WARN("null timer callback for %p (%s:%u - %s(...))\n",
1110
+								tl, (tl->add_file)?tl->add_file:"unknown",
1111
+								tl->add_line,
1112
+								(tl->add_func)?tl->add_func:"unknown");
1113
+#else
1114
+						LM_WARN("null callback function for %p\n", tl);
1115
+#endif
1116
+					}
1105 1117
 					/* reset the configuration group handles */
1106 1118
 					cfg_reset_all();
1107 1119
 					if (ret==0){