summaryrefslogtreecommitdiff
path: root/hal/timer/src
diff options
context:
space:
mode:
Diffstat (limited to 'hal/timer/src')
-rw-r--r--hal/timer/src/timer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hal/timer/src/timer.c b/hal/timer/src/timer.c
index afc8a437b3..d6e981016d 100644
--- a/hal/timer/src/timer.c
+++ b/hal/timer/src/timer.c
@@ -178,7 +178,8 @@ hal_timer_instance_cancel (hal_timer_t *ctx, hal_timer_instance_t *instance)
cyg_mutex_lock (&ctx->heap_mutex);
// add the node to the heap.
- heap_remove (&ctx->heap, &instance->node);
+ if (!heap_empty (&ctx->heap))
+ heap_remove (&ctx->heap, &instance->node);
// unlock the mutex.
cyg_mutex_unlock (&ctx->heap_mutex);