diff --git a/simclist.c b/simclist.c index 1b8d3c8..e6c93b1 100755 --- a/simclist.c +++ b/simclist.c @@ -472,6 +472,9 @@ void *list_extract_at(list_t *restrict l, unsigned int pos) { list_drop_elem(l, tmp, pos); l->numels--; + if (0 == l->numels) + l->mid = NULL; + assert(list_repOk(l)); return data; @@ -555,6 +558,8 @@ int list_delete_at(list_t *restrict l, unsigned int pos) { l->numels--; + if (0 == l->numels) + l->mid = NULL; assert(list_repOk(l));