aboutsummaryrefslogtreecommitdiff
path: root/lib/llist.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-12-28 16:01:02 -0600
committerRob Landley <rob@landley.net>2019-12-28 16:01:02 -0600
commitb17fc0c2ce6581b7b48b8ffe457661b01289f8fe (patch)
tree5290512e731e53e56880749aeb73fbe100801c69 /lib/llist.c
parente5cec287909be098d2484690222d95bc02a8030b (diff)
downloadtoybox-b17fc0c2ce6581b7b48b8ffe457661b01289f8fe.tar.gz
Allow dlist_terminate() to be called repeatedly on same list.
Diffstat (limited to 'lib/llist.c')
-rw-r--r--lib/llist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/llist.c b/lib/llist.c
index e1e6a564..45fe014d 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -109,7 +109,7 @@ void *dlist_terminate(void *list)
{
struct double_list *end = list;
- if (!list) return 0;
+ if (!end || !end->prev) return 0;
end = end->prev;
end->next->prev = 0;