schema compile MAINTENANCE unused variable removed
diff --git a/src/tree_data.c b/src/tree_data.c
index 5ff8aaf..9b8d953 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -1850,7 +1850,7 @@
     lyd_insert_hash(node);
 
     /* finish hashes for our parent, if needed and possible */
-    if (node->schema && (node->schema->flags & LYS_KEY) && lyd_insert_has_keys(parent)) {
+    if (node->schema && (node->schema->flags & LYS_KEY) && parent && lyd_insert_has_keys(parent)) {
         lyd_hash(parent);
 
         /* now we can insert even the list into its parent HT */