Fix: crash when opening file with visible node editor

Caused by rB87fd798ae383a344d51dcbd9f66d5834595bdc5a.
This commit is contained in:
Jacques Lucke 2023-01-07 20:54:14 +01:00
parent 2895c67086
commit e22247a965
Notes: blender-bot 2023-02-14 06:00:45 +01:00
Referenced by issue #103715, Regression: Node Editor: Debug assert if cursor over node editor area when blender start
1 changed files with 4 additions and 0 deletions

View File

@ -1131,6 +1131,10 @@ bNodeSocket *node_find_indicated_socket(SpaceNode &snode,
snode.edittree->ensure_topology_cache();
const Span<float2> socket_locations = snode.runtime->all_socket_locations;
if (socket_locations.is_empty()) {
/* Sockets haven't been drawn yet, e.g. when the file is currently opening. */
return nullptr;
}
const Span<bNode *> nodes = snode.edittree->all_nodes();
for (int i = nodes.index_range().last(); i >= 0; i--) {