summaryrefslogtreecommitdiff
path: root/src/shared/prioq.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/prioq.c')
-rw-r--r--src/shared/prioq.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/shared/prioq.c b/src/shared/prioq.c
index 2d166360aa..537befc623 100644
--- a/src/shared/prioq.c
+++ b/src/shared/prioq.c
@@ -217,7 +217,8 @@ _pure_ static struct prioq_item* find_item(Prioq *q, void *data, unsigned *idx)
assert(q);
if (idx) {
- if (*idx > q->n_items)
+ if (*idx == PRIOQ_IDX_NULL ||
+ *idx > q->n_items)
return NULL;
i = q->items + *idx;