aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/json_util.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/json_util.h b/lib/json_util.h
index fa4510bb..e0f1f7b8 100644
--- a/lib/json_util.h
+++ b/lib/json_util.h
@@ -25,9 +25,10 @@
#define JSON_O_FOREACH(o, k, v) \
char *k; json_value *v; int __i; \
- for( __i = 0; k = (o)->u.object.values[__i].name, \
- v = (o)->u.object.values[__i].value, \
- __i < (o)->u.object.length; __i ++ )
+ for( __i = 0; ( __i < (o)->u.object.length ) && \
+ ( k = (o)->u.object.values[__i].name ) && \
+ ( v = (o)->u.object.values[__i].value ); \
+ __i ++ )
json_value *json_o_get( const json_value *obj, const json_char *name );
const char *json_o_str( const json_value *obj, const json_char *name );