tree data BUGFIX prevent creating invalid trees
diff --git a/src/tree_data.c b/src/tree_data.c
index dede407..e1463ea 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -1078,7 +1078,7 @@
 {
     struct lyd_node *first_sibling;
 
-    LY_CHECK_ARG_RET(NULL, node, LY_EINVAL);
+    LY_CHECK_ARG_RET(NULL, node, sibling != node, LY_EINVAL);
 
     if (sibling) {
         LY_CHECK_RET(lyd_insert_check_schema(NULL, sibling->schema, node->schema));