printer lyb BUGFIX reading module of opauqe nodes
All top-level nodes have their module stored.
If opaque, all their opaque descendants as well.
Nodes with schema never have their module stored
for descendants.
diff --git a/src/printer_lyb.c b/src/printer_lyb.c
index b77e07d..111fb2b 100644
--- a/src/printer_lyb.c
+++ b/src/printer_lyb.c
@@ -927,9 +927,9 @@
LY_CHECK_RET(lyb_write_start_subtree(out, lybctx->lybctx));
/* write model info first, for all opaque and top-level nodes */
- if (!node->schema) {
+ if (!node->schema && (!node->parent || !node->parent->schema)) {
LY_CHECK_RET(lyb_print_model(out, NULL, lybctx->lybctx));
- } else if (!lysc_data_parent(node->schema)) {
+ } else if (node->schema && !lysc_data_parent(node->schema)) {
LY_CHECK_RET(lyb_print_model(out, node->schema->module, lybctx->lybctx));
}