Prevent editor crash when deleting children of GraphNode

This commit is contained in:
zhangjianguo 2022-11-29 09:10:45 +08:00
parent 4a82d71d73
commit 8e1138d59a

View File

@ -366,6 +366,7 @@ void GraphNode::_notification(int p_what) {
close_rect = Rect2();
}
if (get_child_count() > 0) {
for (const KeyValue<int, Slot> &E : slot_info) {
if (E.key < 0 || E.key >= cache_y.size()) {
continue;
@ -394,12 +395,19 @@ void GraphNode::_notification(int p_what) {
// Draw slot stylebox.
if (s.draw_stylebox) {
Control *c = Object::cast_to<Control>(get_child(E.key));
if (!c || !c->is_visible_in_tree()) {
continue;
}
if (c->is_set_as_top_level()) {
continue;
}
Rect2 c_rect = c->get_rect();
c_rect.position.x = sb->get_margin(SIDE_LEFT);
c_rect.size.width = w;
draw_style_box(sb_slot, c_rect);
}
}
}
if (resizable) {
draw_texture(resizer, get_size() - resizer->get_size(), resizer_color);