From 98610bfcecf618b2c7c179236132042a34b546fa Mon Sep 17 00:00:00 2001 From: nmlgc Date: Sat, 28 Dec 2013 05:58:09 +0100 Subject: [PATCH] Check for key == NULL in json_object_get and json_object_del --- src/value.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/value.c b/src/value.c index 417ea85..336873b 100644 --- a/src/value.c +++ b/src/value.c @@ -76,7 +76,7 @@ json_t *json_object_get(const json_t *json, const char *key) { json_object_t *object; - if(!json_is_object(json)) + if(!key || !json_is_object(json)) return NULL; object = json_to_object(json); @@ -121,7 +121,7 @@ int json_object_del(json_t *json, const char *key) { json_object_t *object; - if(!json_is_object(json)) + if(!key || !json_is_object(json)) return -1; object = json_to_object(json);