Fix collections list_pop_front bug.

* Thanks to Rocky Song for finding the bug.
This commit is contained in:
iabdalkader 2018-05-19 23:42:48 +02:00
parent 36948fff45
commit 97518da1df

View File

@ -294,7 +294,9 @@ void list_pop_front(list_t *ptr, void *data)
memcpy(data, tmp->data, ptr->data_len);
}
tmp->next_ptr->prev_ptr = NULL;
if (tmp->next_ptr) {
tmp->next_ptr->prev_ptr = NULL;
}
ptr->head_ptr = tmp->next_ptr;
ptr->size -= 1;
xfree(tmp);