diff options
Diffstat (limited to 'libc/stack.c')
-rw-r--r-- | libc/stack.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libc/stack.c b/libc/stack.c index e86a8c6..0cbb69d 100644 --- a/libc/stack.c +++ b/libc/stack.c @@ -102,7 +102,8 @@ void *stack_pop(struct stack *stack) struct stack_node *prev = stack->tail; - stack->tail->prev->next = NULL; + if (stack->tail->prev) + stack->tail->prev->next = NULL; stack->tail = stack->tail->prev; void *data = prev->data; |