From e8d6526926e4b67a896fb01ad8366e47c3168682 Mon Sep 17 00:00:00 2001
From: David Maciejak <david.maciejak@gmail.com>
Date: Sun, 27 Jul 2014 14:15:51 +0800
Subject: [PATCH 1/4] WINGs: correct possible null pointer dereference

As reported by cppcheck:

[WINGs/array.c:129] -> [WINGs/array.c:131]: (warning) Possible null pointer dereference: array - otherwise it is redundant to check it against null.
[WINGs/array.c:151] -> [WINGs/array.c:153]: (warning) Possible null pointer dereference: array - otherwise it is redundant to check it against null.
[WINGs/array.c:170] -> [WINGs/array.c:172]: (warning) Possible null pointer dereference: array - otherwise it is redundant to check it against null.

This patch is checking that the var name 'array' exists.
---
 WINGs/array.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/WINGs/array.c b/WINGs/array.c
index 0e08342..0b5be94 100644
--- a/WINGs/array.c
+++ b/WINGs/array.c
@@ -126,7 +126,7 @@ void WMAddToArray(WMArray * array, void *item)
 
 void WMInsertInArray(WMArray * array, int index, void *item)
 {
-	wassertr(index >= 0 && index <= array->itemCount);
+	wassertr(array && index >= 0 && index <= array->itemCount);
 
 	if (array == NULL)
 		return;
@@ -148,7 +148,7 @@ void *WMReplaceInArray(WMArray * array, int index, void *item)
 {
 	void *old;
 
-	wassertrv(index >= 0 && index <= array->itemCount, NULL);
+	wassertrv(array && index >= 0 && index <= array->itemCount, NULL);
 
 	if (array == NULL)
 		return NULL;
@@ -167,7 +167,7 @@ void *WMReplaceInArray(WMArray * array, int index, void *item)
 
 int WMDeleteFromArray(WMArray * array, int index)
 {
-	wassertrv(index >= 0 && index < array->itemCount, 0);
+	wassertrv(array && index >= 0 && index < array->itemCount, 0);
 
 	if (array == NULL)
 		return 0;
-- 
1.8.3.2

