diff options
-rw-r--r-- | src/include/gnunet_json_lib.h | 2 | ||||
-rw-r--r-- | src/json/json.c | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h index 92597d3dd..3dc79105e 100644 --- a/src/include/gnunet_json_lib.h +++ b/src/include/gnunet_json_lib.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2014, 2015, 2016 GNUnet e.V. | 3 | Copyright (C) 2014, 2015, 2016, 2020 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
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; |