Fix #134592: Node Editor space_*_get Unregistered Tree Type Returns
When needing a friendly title and icon for windows and screen areas we use SpaceType callbacks. For Node editors this could crash for custom node trees that are unregistered. node_tree_type_find returns nullptr since this custom tree type is not in the map. In this case just return translated "Node Editor". Pull Request: https://projects.blender.org/blender/blender/pulls/134692
This commit is contained in:
committed by
Harley Acheson
parent
3e77dd1e46
commit
37c0b2c47d
@@ -38,6 +38,8 @@
|
||||
#include "BKE_node_tree_zones.hh"
|
||||
#include "BKE_screen.hh"
|
||||
|
||||
#include "BLT_translation.hh"
|
||||
|
||||
#include "ED_image.hh"
|
||||
#include "ED_node.hh"
|
||||
#include "ED_node_preview.hh"
|
||||
@@ -1344,6 +1346,9 @@ static blender::StringRefNull node_space_name_get(const ScrArea *area)
|
||||
{
|
||||
SpaceNode *snode = static_cast<SpaceNode *>(area->spacedata.first);
|
||||
bke::bNodeTreeType *tree_type = bke::node_tree_type_find(snode->tree_idname);
|
||||
if (tree_type == nullptr) {
|
||||
return IFACE_("Node Editor");
|
||||
}
|
||||
return tree_type->ui_name;
|
||||
}
|
||||
|
||||
@@ -1351,6 +1356,9 @@ static int node_space_icon_get(const ScrArea *area)
|
||||
{
|
||||
SpaceNode *snode = static_cast<SpaceNode *>(area->spacedata.first);
|
||||
bke::bNodeTreeType *tree_type = bke::node_tree_type_find(snode->tree_idname);
|
||||
if (tree_type == nullptr) {
|
||||
return ICON_NODETREE;
|
||||
}
|
||||
return tree_type->ui_icon;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user