parser json BUGFIX added condition for opaq node
diff --git a/src/validation.c b/src/validation.c
index 8a05adc..b9eda81 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -1372,7 +1372,7 @@
LY_CHECK_RET(lyd_validate_final_r(lyd_child(node), node, node->schema, NULL, val_opts, int_opts));
/* set default for containers */
- if ((node->schema->nodetype == LYS_CONTAINER) && !(node->schema->flags & LYS_PRESENCE)) {
+ if (node->schema && (node->schema->nodetype == LYS_CONTAINER) && !(node->schema->flags & LYS_PRESENCE)) {
LY_LIST_FOR(lyd_child(node), next) {
if (!(next->flags & LYD_DEFAULT)) {
break;
diff --git a/tests/utests/data/test_parser_json.c b/tests/utests/data/test_parser_json.c
index a2014a0..39faaa2 100644
--- a/tests/utests/data/test_parser_json.c
+++ b/tests/utests/data/test_parser_json.c
@@ -419,6 +419,11 @@
CHECK_LYD_STRING(tree, LYD_PRINT_SHRINK | LYD_PRINT_WITHSIBLINGS, data);
lyd_free_all(tree);
+ /* mixing with metadata that is ignored */
+ data = "{\"@a:foo\":\"str\",\"@a:foo3\":1,\"a:foo3\":2}";
+ CHECK_PARSE_LYD(data, 0, LYD_VALIDATE_PRESENT, tree);
+ lyd_free_all(tree);
+
/* empty name */
PARSER_CHECK_ERROR("{\"@a:foo\":{\"\":0}}", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
"A JSON object member name cannot be a zero-length string.", "Line number 1.");