xpath BUGFIX opaque node handling

Fixes #2144
diff --git a/src/xpath.c b/src/xpath.c
index 06c44df..bee8e2c 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -1482,7 +1482,7 @@
                 LYD_TREE_DFS_continue = 0;
             }
 
-            if ((root_type == LYXP_NODE_ROOT_CONFIG) && (elem->schema->flags & LYS_CONFIG_R)) {
+            if ((root_type == LYXP_NODE_ROOT_CONFIG) && elem->schema && (elem->schema->flags & LYS_CONFIG_R)) {
                 /* skip */
                 LYD_TREE_DFS_continue = 1;
             } else {