xpath BUGFIX handle non-term nodes in deref
Fixes cesnet/netopeer2#961
diff --git a/src/xpath.c b/src/xpath.c
index 08b79dd..5683ed4 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -3750,7 +3750,7 @@
if (args[0]->type != LYXP_SET_SCNODE_SET) {
LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
} else if ((sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
- if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
+ if (!(sleaf->nodetype & LYD_NODE_TERM)) {
LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype),
sleaf->name);
} else if (!warn_is_specific_type(sleaf->type, LY_TYPE_LEAFREF) &&
@@ -3760,7 +3760,7 @@
}
}
set_scnode_clear_ctx(set, LYXP_SET_SCNODE_ATOM_VAL);
- if (sleaf && (sleaf->type->basetype == LY_TYPE_LEAFREF)) {
+ if (sleaf && (sleaf->nodetype & LYD_NODE_TERM) && (sleaf->type->basetype == LY_TYPE_LEAFREF)) {
lref = (struct lysc_type_leafref *)sleaf->type;
oper = (sleaf->flags & LYS_IS_OUTPUT) ? LY_PATH_OPER_OUTPUT : LY_PATH_OPER_INPUT;