Fix for 30439, Cycles node group conversion wasn't checking node->id pointer (group...
authorLukas Toenne <lukas.toenne@googlemail.com>
Tue, 6 Mar 2012 11:34:57 +0000 (11:34 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Tue, 6 Mar 2012 11:34:57 +0000 (11:34 +0000)
Also fixed similar issue in node_templates.c where the group tree is used to generate a button name.

intern/cycles/blender/blender_shader.cpp
source/blender/editors/space_node/node_templates.c

index 415a043cf78aa1a424965328d6d58bc7897a6aee..45076122467a575b894293980d7100f64701a546 100644 (file)
@@ -517,6 +517,9 @@ static void add_nodes(BL::BlendData b_data, ShaderGraph *graph, BL::ShaderNodeTr
                        /* add proxy converter nodes for inputs and outputs */
                        BL::NodeGroup b_gnode(*b_node);
                        BL::ShaderNodeTree b_group_ntree(b_gnode.node_tree());
+                       if (!b_group_ntree)
+                               continue;
+
                        BL::Node::inputs_iterator b_input;
                        BL::Node::outputs_iterator b_output;
                        
index 24fb55be38ed108ccb4072560fbfba985464c109..781f37918fd11e24527f56e38bf72be2822fd77a 100644 (file)
@@ -277,8 +277,12 @@ static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
                bNode *node = sock->link->fromnode;
                char node_name[UI_MAX_NAME_STR];
 
-               if(node->type == NODE_GROUP)
-                       BLI_strncpy(node_name, node->id->name+2, UI_MAX_NAME_STR);
+               if(node->type == NODE_GROUP) {
+                       if (node->id)
+                               BLI_strncpy(node_name, node->id->name+2, UI_MAX_NAME_STR);
+                       else
+                               BLI_strncpy(node_name, "Group", UI_MAX_NAME_STR);
+               }
                else
                        BLI_strncpy(node_name, node->typeinfo->name, UI_MAX_NAME_STR);