From 54373160dfff917c4cf5cb7071711ba41856e71c Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Wed, 1 Jan 2025 22:20:57 +0100 Subject: [PATCH] Fix Crash with `GraphNode` When using `queue_free()` on GraphNodes, `p_from` can become `nullprt`. This PR adds a check to prevent crashes in these situations. --- scene/gui/graph_edit_arranger.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scene/gui/graph_edit_arranger.cpp b/scene/gui/graph_edit_arranger.cpp index 55fbb78fab..f017346b66 100644 --- a/scene/gui/graph_edit_arranger.cpp +++ b/scene/gui/graph_edit_arranger.cpp @@ -79,6 +79,9 @@ void GraphEditArranger::arrange_nodes() { for (const Ref &connection : connection_list) { GraphNode *p_from = Object::cast_to(node_names[connection->from_node]); + if (!p_from) { + continue; + } if (connection->to_node == graph_element->get_name() && (p_from->is_selected() || arrange_entire_graph) && connection->to_node != connection->from_node) { if (!s.has(p_from->get_name())) { s.insert(p_from->get_name());