From 72dabe9f72f26bda476ecf2f226d475099fe7824 Mon Sep 17 00:00:00 2001 From: Michael Cardell Widerkrantz Date: Mon, 1 Nov 2010 21:30:32 +0100 Subject: Checking for NULLs. --- list.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'list.c') diff --git a/list.c b/list.c index 3f5324e..ab278a1 100644 --- a/list.c +++ b/list.c @@ -13,6 +13,11 @@ void movetohead(struct item **mainlist, struct item *item) { + if (NULL == item || NULL == mainlist || NULL == *mainlist) + { + return; + } + if (*mainlist == item) { /* Already at head. Do nothing. */ @@ -74,7 +79,7 @@ void delitem(struct item **mainlist, struct item *item) { struct item *ml = *mainlist; - if (NULL == mainlist) + if (NULL == mainlist || NULL == *mainlist || NULL == item) { return; } -- cgit v1.2.3