Skip to content

Commit fd0d96e

Browse files
committed
fix: VariationNode::stealChildrenOf
Previously, this method always crashed because addChildren assumes the given children to have no parent. Yet, the children always had 'other' as parent because we only removed them afterwards.
1 parent a48b4fd commit fd0d96e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/main/java/org/variantsync/diffdetective/variation/tree/VariationNode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,9 @@ public void drop() {
282282
* @see removeAllChildren
283283
*/
284284
public void stealChildrenOf(final T other) {
285-
addChildren(other.getChildren());
285+
List<T> children = other.getChildren();
286286
other.removeAllChildren();
287+
addChildren(children);
287288
}
288289

289290
/**

0 commit comments

Comments
 (0)