diff --git a/ft-lib/bcache.c b/ft-lib/bcache.c index f9f474a..fd6a54c 100644 --- a/ft-lib/bcache.c +++ b/ft-lib/bcache.c @@ -51,6 +51,9 @@ static inline struct list_head *list_pop(struct list_head *head) { struct list_head *l; + if (head->next == head) + raise("list is empty\n"); + l = head->next; list_del(l); return l;