From 49c4ad76e178115813edf654c3daa1a9a9338336 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 20 May 2008 12:05:27 +0200 Subject: [PATCH] Add missing NULL test. --- src/std/c_list.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/std/c_list.c b/src/std/c_list.c index 55a796f47..d47f4f2a6 100644 --- a/src/std/c_list.c +++ b/src/std/c_list.c @@ -323,6 +323,10 @@ c_list_t *c_list_last(c_list_t *list) { * Gets the element at the given positon in a c_list */ c_list_t *c_list_position(c_list_t *list, long position) { + if (list == NULL) { + return NULL; + } + while ((position-- > 0) && list != NULL) { list = list->next; }