Skip to content

Commit 74de8c1

Browse files
authored
tree data BUGFIX inserting nested ext-inst data (#2420)
Co-authored-by: Humblesaw <[email protected]>
1 parent 13925ae commit 74de8c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tree_data.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ lyd_insert_node_find_anchor(struct lyd_node *first_sibling, struct lyd_node *nod
688688
{
689689
struct lyd_node *anchor;
690690

691-
if (first_sibling && (first_sibling->flags & LYD_EXT)) {
691+
if ((node->flags & LYD_EXT) && (!first_sibling || !(first_sibling->prev->flags & LYD_EXT))) {
692692
return NULL;
693693
}
694694

@@ -767,7 +767,7 @@ lyd_insert_node(struct lyd_node *parent, struct lyd_node **first_sibling_p, stru
767767
}
768768
first_sibling = parent ? lyd_child(parent) : *first_sibling_p;
769769

770-
if ((order == LYD_INSERT_NODE_LAST) || !node->schema || (first_sibling && (first_sibling->flags & LYD_EXT))) {
770+
if ((order == LYD_INSERT_NODE_LAST) || !node->schema) {
771771
lyd_insert_node_last(parent, &first_sibling, node);
772772
} else if (order == LYD_INSERT_NODE_LAST_BY_SCHEMA) {
773773
lyd_insert_node_ordby_schema(parent, &first_sibling, node);

0 commit comments

Comments
 (0)