mirror of
https://github.com/eliasstepanik/egui_node_graph.git
synced 2026-01-11 13:58:28 +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 {
|
if let Some(node) = self.state.user_state.active_node {
|
||||||
let text = match evaluate_node(&self.state.graph, node, &mut HashMap::new()) {
|
if self.state.graph.nodes.contains_key(node) {
|
||||||
Ok(value) => format!("The result is: {:?}", value),
|
let text = match evaluate_node(&self.state.graph, node, &mut HashMap::new()) {
|
||||||
Err(err) => format!("Execution error: {}", err),
|
Ok(value) => format!("The result is: {:?}", value),
|
||||||
};
|
Err(err) => format!("Execution error: {}", err),
|
||||||
ctx.debug_painter().text(
|
};
|
||||||
egui::pos2(10.0, 10.0),
|
ctx.debug_painter().text(
|
||||||
egui::Align2::LEFT_TOP,
|
egui::pos2(10.0, 10.0),
|
||||||
text,
|
egui::Align2::LEFT_TOP,
|
||||||
egui::TextStyle::Button,
|
text,
|
||||||
egui::Color32::WHITE,
|
egui::TextStyle::Button,
|
||||||
);
|
egui::Color32::WHITE,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
self.state.user_state.active_node = None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user