summaryrefslogtreecommitdiff
path: root/hal/timer/src
diff options
context:
space:
mode:
authorlaranjeiro2008-01-29 14:38:18 +0000
committerlaranjeiro2008-01-29 14:38:18 +0000
commitd98d13c6c459e7e047b995f34f5aeb10eecd5ccd (patch)
tree3b76907e8c6c0556341b3246db40de2a9b423c15 /hal/timer/src
parentb62bd165666a219b8d8454a3d7f989a7111aac42 (diff)
Add the test to verify if the heap is empty before removing an instance from it.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1345 017c9cb6-072f-447c-8318-d5b54f68fe89
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);