fix: don't adjust parent tree's stack size when composting

This commit is contained in:
Nat 2024-12-26 17:33:45 -04:00
parent 912aca2a89
commit 2252be416e
1 changed files with 8 additions and 1 deletions

View File

@ -234,7 +234,14 @@ fn main() -> io::Result<()> {
let tree = trees.remove(&tree_id).unwrap();
(tree.parent_id, tree.stack_size)
};
let parent = trees.get_mut(&parent_id).unwrap();
// One tree is "its own" parent, namely, the seed tree, in which
// case this `get_mut` will return None
let parent = match trees.get_mut(&parent_id) {
Some(p) => p,
None => continue
};
parent.stack_size += recovered_stack_size;
}