Browse Source

Check for initialised ckmsgq when checking if the queue is empty

master
Con Kolivas 10 years ago
parent
commit
8a0d0667e3
  1. 5
      src/ckpool.c

5
src/ckpool.c

@ -165,10 +165,11 @@ void ckmsgq_add(ckmsgq_t *ckmsgq, void *data)
/* Return whether there are any messages queued in the ckmsgq linked list. */ /* Return whether there are any messages queued in the ckmsgq linked list. */
bool ckmsgq_empty(ckmsgq_t *ckmsgq) bool ckmsgq_empty(ckmsgq_t *ckmsgq)
{ {
bool ret; bool ret = true;
mutex_lock(&ckmsgq->lock); mutex_lock(&ckmsgq->lock);
ret = (ckmsgq->msgs->next == ckmsgq->msgs->prev); if (ckmsgq->msgs)
ret = (ckmsgq->msgs->next == ckmsgq->msgs->prev);
mutex_unlock(&ckmsgq->lock); mutex_unlock(&ckmsgq->lock);
return ret; return ret;

Loading…
Cancel
Save