summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cardell Widerkrantz <mc@hack.org>2010-11-01 21:30:32 +0100
committerMichael Cardell Widerkrantz <mc@hack.org>2010-11-01 21:30:32 +0100
commit72dabe9f72f26bda476ecf2f226d475099fe7824 (patch)
tree7de03b78dfecaed820d5337420710d7cb2f5842f
parentda1e8d8099a54a0f49791af5e2baa234ed88278c (diff)
downloadmcwm-72dabe9f72f26bda476ecf2f226d475099fe7824.zip
Checking for NULLs.
-rw-r--r--list.c7
1 files changed, 6 insertions, 1 deletions
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;
}