Timer heap checks if callback is NULL
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@114 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/src/pj/timer.c b/pjlib/src/pj/timer.c
index 212f04a..8eaab79 100644
--- a/pjlib/src/pj/timer.c
+++ b/pjlib/src/pj/timer.c
@@ -444,6 +444,7 @@
pj_time_val expires;
PJ_ASSERT_RETURN(ht && entry && delay, PJ_EINVAL);
+ PJ_ASSERT_RETURN(entry->cb != NULL, PJ_EINVAL);
pj_gettimeofday(&expires);
PJ_TIME_VAL_ADD(expires, *delay);
@@ -494,7 +495,8 @@
++count;
unlock_timer_heap(ht);
- (*node->cb)(ht, node);
+ if (node->cb)
+ (*node->cb)(ht, node);
lock_timer_heap(ht);
}
if (ht->cur_size && next_delay) {