parser xml BUGFIX opaque anchor check
diff --git a/src/parser_xml.c b/src/parser_xml.c
index 77cd720..cb237f5 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -676,7 +676,7 @@
         if (parent && (node->schema->flags & LYS_KEY)) {
             /* check the key order, the anchor must never be a key */
             anchor = lyd_insert_get_next_anchor(lyd_child(parent), node);
-            if (anchor && (anchor->schema->flags & LYS_KEY)) {
+            if (anchor && anchor->schema && (anchor->schema->flags & LYS_KEY)) {
                 if (lydctx->parse_opts & LYD_PARSE_STRICT) {
                     LOGVAL(ctx, LYVE_DATA, "Invalid position of the key \"%s\" in a list.", node->schema->name);
                     ret = LY_EVALID;