From 9578d7a7fba9310ac7a8079af0cdd160bc080b87 Mon Sep 17 00:00:00 2001 From: Jeremie Leska Date: Tue, 18 Jun 2024 10:53:04 +0200 Subject: [PATCH] diff BUGFIX check nodes before inserting after The mode must be different and have the same schema. Fixes: c80fcc9d0d0c ("diff BUGFIX diff merge userord node order") --- src/diff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/diff.c b/src/diff.c index 76f9c6af2..c8b56d0a6 100644 --- a/src/diff.c +++ b/src/diff.c @@ -1660,7 +1660,8 @@ lyd_diff_merge_create(struct lyd_node **diff_match, struct lyd_node **diff, enum /* previous created nodes affect the metadata so move it at the end */ child = lyd_first_sibling(*diff_match); - if (child->next) { + if (child->next && (child->prev != *diff_match) && + (child->prev->schema == (*diff_match)->schema)) { LY_CHECK_RET(lyd_insert_after(child->prev, *diff_match)); } } else {