xpath BUGFIX opaque node handling (#2182)

Co-authored-by: zhangtao 00621101 <zhangtao387@huawei.com>
diff --git a/src/xpath.c b/src/xpath.c
index 09f1111..f549b49 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -4187,7 +4187,7 @@
             leaf = (struct lyd_node_term *)args[0]->val.nodes[i].node;
             sleaf = (struct lysc_node_leaf *)leaf->schema;
             val = &leaf->value;
-            if (!(sleaf->nodetype & LYD_NODE_TERM) || (leaf->value.realtype->basetype != LY_TYPE_IDENT)) {
+            if (!sleaf || !(sleaf->nodetype & LYD_NODE_TERM) || (leaf->value.realtype->basetype != LY_TYPE_IDENT)) {
                 /* uninteresting */
                 continue;
             }