Skip to content

Commit

Permalink
cJSON_ArrayForEach: Fix handling of NULL pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
FSMaxB committed Feb 21, 2017
1 parent bc12c69 commit b47d0e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cJSON.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit b47d0e3

Please sign in to comment.