mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
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.
This commit is contained in:
committed by
Carlos R. Mafra
parent
abc2d13f7d
commit
39e1398257
@@ -126,7 +126,7 @@ void WMAddToArray(WMArray * array, void *item)
|
|||||||
|
|
||||||
void WMInsertInArray(WMArray * array, int index, 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)
|
if (array == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -148,7 +148,7 @@ void *WMReplaceInArray(WMArray * array, int index, void *item)
|
|||||||
{
|
{
|
||||||
void *old;
|
void *old;
|
||||||
|
|
||||||
wassertrv(index >= 0 && index <= array->itemCount, NULL);
|
wassertrv(array && index >= 0 && index <= array->itemCount, NULL);
|
||||||
|
|
||||||
if (array == NULL)
|
if (array == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -167,7 +167,7 @@ void *WMReplaceInArray(WMArray * array, int index, void *item)
|
|||||||
|
|
||||||
int WMDeleteFromArray(WMArray * array, int index)
|
int WMDeleteFromArray(WMArray * array, int index)
|
||||||
{
|
{
|
||||||
wassertrv(index >= 0 && index < array->itemCount, 0);
|
wassertrv(array && index >= 0 && index < array->itemCount, 0);
|
||||||
|
|
||||||
if (array == NULL)
|
if (array == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user