tree data BUGFIX path for node with opaque parent

Fixes #1764
diff --git a/src/tree_data.c b/src/tree_data.c
index c9dd7f7..7c89b62 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -4041,7 +4041,8 @@
 iter_print:
             /* print prefix and name */
             mod = NULL;
-            if (iter->schema && (!iter->parent || (iter->schema->module != iter->parent->schema->module))) {
+            if (iter->schema && (!iter->parent || !iter->parent->schema ||
+                    (iter->schema->module != iter->parent->schema->module))) {
                 mod = iter->schema->module;
             }