From 87691a86e5fca6551a1a8504ac67b87f829a6561 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Sun, 19 Feb 2017 19:58:41 +0100 Subject: [PATCH] cJSON_SetNumberValue: Fix compiler warning with -Waddress --- cJSON.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON.h b/cJSON.h index e4a7856..647cc62 100644 --- a/cJSON.h +++ b/cJSON.h @@ -173,7 +173,7 @@ extern void cJSON_Minify(char *json); #define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number)) /* helper for the cJSON_SetNumberValue macro */ extern double cJSON_SetNumberHelper(cJSON *object, double number); -#define cJSON_SetNumberValue(object, number) ((object) ? cJSON_SetNumberHelper(object, (double)number) : (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)