mirror of
https://github.com/eliasstepanik/egui_node_graph.git
synced 2026-01-11 05:48:27 +00:00
Fix a crash bug when deleting an active node
This commit is contained in:
parent
8408503866
commit
b81479cc88
@ -376,17 +376,21 @@ impl epi::App for NodeGraphExample {
|
||||
}
|
||||
|
||||
if let Some(node) = self.state.user_state.active_node {
|
||||
let text = match evaluate_node(&self.state.graph, node, &mut HashMap::new()) {
|
||||
Ok(value) => format!("The result is: {:?}", value),
|
||||
Err(err) => format!("Execution error: {}", err),
|
||||
};
|
||||
ctx.debug_painter().text(
|
||||
egui::pos2(10.0, 10.0),
|
||||
egui::Align2::LEFT_TOP,
|
||||
text,
|
||||
egui::TextStyle::Button,
|
||||
egui::Color32::WHITE,
|
||||
);
|
||||
if self.state.graph.nodes.contains_key(node) {
|
||||
let text = match evaluate_node(&self.state.graph, node, &mut HashMap::new()) {
|
||||
Ok(value) => format!("The result is: {:?}", value),
|
||||
Err(err) => format!("Execution error: {}", err),
|
||||
};
|
||||
ctx.debug_painter().text(
|
||||
egui::pos2(10.0, 10.0),
|
||||
egui::Align2::LEFT_TOP,
|
||||
text,
|
||||
egui::TextStyle::Button,
|
||||
egui::Color32::WHITE,
|
||||
);
|
||||
} else {
|
||||
self.state.user_state.active_node = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user