diff options
Diffstat (limited to 'src/idxset.c')
-rw-r--r-- | src/idxset.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/idxset.c b/src/idxset.c index f0d7ad87..fe447ac6 100644 --- a/src/idxset.c +++ b/src/idxset.c @@ -152,8 +152,8 @@ int idxset_put(struct idxset*s, void *p, uint32_t *index) { s->hash_table[h] = e; /* Insert into array */ - extend_array(s, s->index); - a = array_index(s, s->index); + extend_array(s, e->index); + a = array_index(s, e->index); assert(a && !*a); *a = e; @@ -185,6 +185,9 @@ void* idxset_get_by_index(struct idxset*s, uint32_t index) { if (!(a = array_index(s, index))) return NULL; + if (!*a) + return NULL; + return (*a)->data; } |