path BUGFIX check for schema parent for relative paths
diff --git a/src/path.c b/src/path.c
index bc819ef..3a70604 100644
--- a/src/path.c
+++ b/src/path.c
@@ -858,6 +858,13 @@
++tok_idx;
} else {
/* relative path */
+ if (!ctx_node) {
+ LOGVAL(ctx, LYVE_XPATH, "No initial schema parent for a relative path.");
+ ret = LY_EVALID;
+ goto cleanup;
+ }
+
+ /* go up the parents for leafref */
while (lref && (expr->tokens[tok_idx] == LYXP_TOKEN_DDOT)) {
if (!ctx_node) {
LOGVAL(ctx, LYVE_XPATH, "Too many parent references in path.");