data tree BUGFIX opaque parent handling
diff --git a/src/tree_data.c b/src/tree_data.c
index c50bb78..3e4d8b5 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -2328,7 +2328,7 @@
         getnext_opts = LYS_GETNEXT_OUTPUT;
     }
 
-    if (first_sibling->parent && first_sibling->parent->children_ht) {
+    if (first_sibling->parent && first_sibling->parent->schema && first_sibling->parent->children_ht) {
         /* find the anchor using hashes */
         sparent = first_sibling->parent->schema;
         schema = lys_getnext(new_node->schema, sparent, NULL, getnext_opts);