tree data BUGFIX unset return value
Refs sysrepo/sysrepo#3269
diff --git a/src/tree_data.c b/src/tree_data.c
index 5158f93..dede407 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -2343,9 +2343,6 @@
/* duplicate the whole (leaf-)list */
rc = lyd_dup_list(&orig, trg_ctx, local_parent, &first_sibling, options, &dup);
LY_CHECK_GOTO(rc, error);
- if (!orig) {
- break;
- }
} else {
rc = lyd_dup_r(orig, trg_ctx, local_parent,
options & LYD_DUP_NO_LYDS ? LYD_INSERT_NODE_LAST_BY_SCHEMA : LYD_INSERT_NODE_DEFAULT,
@@ -2354,7 +2351,7 @@
}
first_dup = first_dup ? first_dup : dup;
- if (nosiblings) {
+ if (nosiblings || !orig) {
break;
}
}