From 4072c5ae828fb87579ed5f61c59e422b2fad262d Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Sun, 20 Nov 2022 20:42:26 +0000 Subject: [PATCH] Fix parent not being integrated before being used to differentiate whilst removing a pointer --- yama/src/operations.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yama/src/operations.rs b/yama/src/operations.rs index 14fe27b..bcea48b 100644 --- a/yama/src/operations.rs +++ b/yama/src/operations.rs @@ -21,10 +21,11 @@ pub fn remove_pointer_safely(pile: &Pile

, 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