data tree BUGFIX handle when in mandatory true node
diff --git a/src/xpath.c b/src/xpath.c
index 69ec47c..db21634 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -8432,7 +8432,7 @@
if (op || !(options & LYXP_SCHEMA)) {
/* general root that can access everything */
return LYXP_NODE_ROOT;
- } else if (!ctx_node || (ctx_node->schema->flags & LYS_CONFIG_W)) {
+ } else if (!ctx_node || !ctx_node->schema || (ctx_node->schema->flags & LYS_CONFIG_W)) {
/* root context node can access only config data (because we said so, it is unspecified) */
return LYXP_NODE_ROOT_CONFIG;
}