1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -04:00

Warn about missing nodes

This commit is contained in:
Emil Ernerfeldt
2023-05-04 16:10:06 +02:00
parent 051ec14b98
commit 6f69a143fe
4 changed files with 14 additions and 4 deletions

View File

@@ -12,9 +12,13 @@ pub trait Behavior<Leaf> {
fn tab_text_for_leaf(&mut self, leaf: &Leaf) -> WidgetText;
fn tab_text_for_node(&mut self, nodes: &Nodes<Leaf>, node_id: NodeId) -> WidgetText {
match &nodes.nodes[&node_id] {
Node::Leaf(leaf) => self.tab_text_for_leaf(leaf),
Node::Branch(branch) => format!("{:?}", branch.get_layout()).into(),
if let Some(node) = nodes.nodes.get(&node_id) {
match node {
Node::Leaf(leaf) => self.tab_text_for_leaf(leaf),
Node::Branch(branch) => format!("{:?}", branch.get_layout()).into(),
}
} else {
"MISSING NODE".into()
}
}