Fix parent not being integrated before being used to differentiate whilst removing a pointer
ci/woodpecker/push/build Pipeline is pending Details
ci/woodpecker/push/release Pipeline is pending Details

This commit is contained in:
Olivier 'reivilibre' 2022-11-20 20:42:26 +00:00
parent d3fe111a06
commit 4072c5ae82
1 changed files with 3 additions and 2 deletions

View File

@ -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)?;
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())?
.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))
} else {
None