Fix parent not being integrated before being used to differentiate whilst removing a pointer
This commit is contained in:
parent
d3fe111a06
commit
4072c5ae82
|
@ -21,10 +21,11 @@ pub fn remove_pointer_safely<P: RawPile>(pile: &Pile<P>, name: &str) -> anyhow::
|
||||||
fully_integrate_pointer_node(pile, &mut this_node.node, &mut this_pointer)?;
|
fully_integrate_pointer_node(pile, &mut this_node.node, &mut this_pointer)?;
|
||||||
|
|
||||||
let new_parent = if let Some(ref new_parent_name) = new_parent_name {
|
let new_parent = if let Some(ref new_parent_name) = new_parent_name {
|
||||||
let new_parent_pointer = pile
|
let mut new_parent_pointer = pile
|
||||||
.read_pointer(new_parent_name.as_str())?
|
.read_pointer(new_parent_name.as_str())?
|
||||||
.ok_or_else(|| anyhow!("Parent pointer {:?} does not exist.", name))?;
|
.ok_or_else(|| anyhow!("Parent pointer {:?} does not exist.", name))?;
|
||||||
let new_parent_node = retrieve_tree_node(&pile, new_parent_pointer.chunk_ref.clone())?;
|
let mut new_parent_node = retrieve_tree_node(&pile, new_parent_pointer.chunk_ref.clone())?;
|
||||||
|
fully_integrate_pointer_node(pile, &mut new_parent_node.node, &mut new_parent_pointer)?;
|
||||||
Some((new_parent_pointer, new_parent_node))
|
Some((new_parent_pointer, new_parent_node))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
Loading…
Reference in New Issue