aboutsummaryrefslogtreecommitdiff
path: root/src/json/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/json/json.c')
-rw-r--r--src/json/json.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/json/json.c b/src/json/json.c
index 0631c51bb..503702962 100644
--- a/src/json/json.c
+++ b/src/json/json.c
@@ -56,11 +56,17 @@ GNUNET_JSON_parse (const json_t *root,
56 if (NULL == spec[i].field) 56 if (NULL == spec[i].field)
57 pos = (json_t *) root; 57 pos = (json_t *) root;
58 else 58 else
59 pos = json_object_get (root, spec[i].field); 59 pos = json_object_get (root,
60 if ((NULL == pos) && (spec[i].is_optional)) 60 spec[i].field);
61 if ( ( (NULL == pos) ||
62 (json_is_null (pos) ) ) &&
63 (spec[i].is_optional) )
61 continue; 64 continue;
62 if ((NULL == pos) || 65 if ( (NULL == pos) ||
63 (GNUNET_OK != spec[i].parser (spec[i].cls, pos, &spec[i]))) 66 (GNUNET_OK !=
67 spec[i].parser (spec[i].cls,
68 pos,
69 &spec[i])) )
64 { 70 {
65 if (NULL != error_json_name) 71 if (NULL != error_json_name)
66 *error_json_name = spec[i].field; 72 *error_json_name = spec[i].field;