Fix: handle invalid node trees more gracefully

This commit is contained in:
Jacques Lucke
2023-06-27 10:07:09 +02:00
parent 1be64e532d
commit bf9687f9bb
2 changed files with 11 additions and 2 deletions

View File

@@ -35,8 +35,10 @@ static const aal::RelationsInNode &get_relations_in_node(const bNode &node, Reso
if (!ntreeIsRegistered(group)) {
return scope.construct<aal::RelationsInNode>();
}
BLI_assert(group->runtime->anonymous_attribute_inferencing);
/* It's possible that the inferencing failed on the group. */
if (!group->runtime->anonymous_attribute_inferencing) {
return scope.construct<aal::RelationsInNode>();
}
return group->runtime->anonymous_attribute_inferencing->tree_relations;
}
}

View File

@@ -295,6 +295,13 @@ static std::unique_ptr<bNodeTreeZones> discover_tree_zones(const bNodeTree &tree
return {};
}
for (const bNode *node : tree.nodes_by_type("NodeGroupOutput")) {
if (tree_zones->zone_by_node_id.contains(node->identifier)) {
/* Group output nodes must not be in a zone. */
return {};
}
}
for (const int node_i : all_nodes.index_range()) {
const bNode *node = all_nodes[node_i];
const int zone_i = tree_zones->zone_by_node_id.lookup_default(node->identifier, -1);