Skip to content

Commit

Permalink
diff BUGFIX check nodes before inserting after
Browse files Browse the repository at this point in the history
The mode must be different and have the same schema.

Fixes: c80fcc9 ("diff BUGFIX diff merge userord node order")
  • Loading branch information
jeremie6wind committed Jun 18, 2024
1 parent c676b2a commit 9578d7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9578d7a

Please sign in to comment.