tree data UPDATE improve error path
diff --git a/src/log.c b/src/log.c
index 92f7c86..a788a2e 100644
--- a/src/log.c
+++ b/src/log.c
@@ -741,7 +741,7 @@
     if (snode->nodetype & (LYS_CHOICE | LYS_CASE)) {
         /* schema-only node */
         return LY_SUCCESS;
-    } else if (lysc_data_parent(snode) != parent->schema) {
+    } else if (lysc_data_parent(snode) != lyd_node_schema(parent)) {
         /* not a direct descendant node */
         return LY_SUCCESS;
     }