Skip to content

Commit

Permalink
Fixing issues when widgets are removed
Browse files Browse the repository at this point in the history
  • Loading branch information
ecton committed Nov 8, 2023
1 parent 747813f commit ab4e402
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ impl Tree {
if hovered == id {
return true;
}
search = data.nodes[&hovered].parent;
search = data.nodes.get(&hovered).and_then(|node| node.parent);
}

false
Expand Down Expand Up @@ -355,7 +355,7 @@ impl TreeData {
let mut hierarchy = Vec::new();
while let Some(managed) = self.widget(widget, tree) {
hierarchy.push(managed);
let Some(parent) = self.nodes[&widget].parent else {
let Some(parent) = self.nodes.get(&widget).and_then(|widget| widget.parent) else {
break;
};
widget = parent;
Expand Down

0 comments on commit ab4e402

Please sign in to comment.