From 8faa03cc9b0f72e4c67c3260c44096e65f5f5f73 Mon Sep 17 00:00:00 2001 From: EvanR Date: Sat, 20 Feb 2010 15:44:14 -0600 Subject: [PATCH] Fixed a bug in list pop, again. This bug was fixed late in the audio branch, before list branch existed. Hopefully this is the last one of these double fixes. --- list.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/list.c b/list.c index b20d6b9..31e744b 100644 --- a/list.c +++ b/list.c @@ -41,9 +41,15 @@ void push(list* L, void* item){ } void* pop(list* L){ - void* item = L->next->item; - remove_from_list(L, L->next); - return item; + if(L->next){ + void* item = L->next->item; + remove_from_list(L, L->next); + return item; + } + else{ + return NULL; + } + } void append(list* L, void* item){ -- 2.11.4.GIT