libyang MAINTENANCE asserts added for coverity
diff --git a/src/parser_xml.c b/src/parser_xml.c
index 9335460..d186eca 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -250,7 +250,8 @@
     (*result)->parent = parent;
     diter = NULL;
     if (schema->nodetype == LYS_LEAF && lys_is_key((struct lys_node_leaf *)schema, &pos)) {
-        /* it is key and we need to insert it into a correct place */
+        /* it is key and we need to insert it into a correct place (a key must have a parent list) */
+        assert(parent);
         for (i = 0, diter = parent->child;
                 diter && i < pos && diter->schema->nodetype == LYS_LEAF && lys_is_key((struct lys_node_leaf *)diter->schema, NULL);
                 i++, diter = diter->next);