cJSON_ArrayForEach: Fix handling of NULL pointers

This commit is contained in:
Max Bruckner 2017-02-21 09:17:34 +01:00
parent bc12c69b54
commit b47d0e34ca
1 changed files with 1 additions and 1 deletions

View File

@ -176,7 +176,7 @@ extern double cJSON_SetNumberHelper(cJSON *object, double number);
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
/* Macro for iterating over an array */
#define cJSON_ArrayForEach(pos, head) for(pos = (head)->child; pos != NULL; pos = pos->next)
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
#ifdef __cplusplus
}