Fix crash in loading/applying static overrides of some nodal material.
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 11 Jun 2018 15:11:26 +0000 (17:11 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Mon, 11 Jun 2018 15:12:47 +0000 (17:12 +0200)
No real idea why node's typeinfo is NULL here... but think we do not
care much in that case, so just adding some NULL checks for now.

source/blender/blenkernel/intern/node.c

index 72a34d3..2031bb4 100644 (file)
@@ -1684,7 +1684,7 @@ static void node_free_node_ex(bNodeTree *ntree, bNode *node, bool remove_animdat
        remove_animdata &= ntree && !(ntree->flag & NTREE_IS_LOCALIZED);
        
        /* extra free callback */
-       if (use_api_free_cb && node->typeinfo->freefunc_api) {
+       if (use_api_free_cb && node->typeinfo != NULL && node->typeinfo->freefunc_api) {
                PointerRNA ptr;
                RNA_pointer_create((ID *)ntree, &RNA_Node, node, &ptr);
                
@@ -1711,7 +1711,7 @@ static void node_free_node_ex(bNodeTree *ntree, bNode *node, bool remove_animdat
                        BKE_animdata_fix_paths_remove((ID *)ntree, prefix);
                }
 
-               if (ntree->typeinfo->free_node_cache)
+               if (node->typeinfo != NULL && ntree->typeinfo->free_node_cache)
                        ntree->typeinfo->free_node_cache(ntree, node);
                
                /* texture node has bad habit of keeping exec data around */
@@ -1721,7 +1721,7 @@ static void node_free_node_ex(bNodeTree *ntree, bNode *node, bool remove_animdat
                }
        }
 
-       if (node->typeinfo->freefunc) {
+       if (node->typeinfo != NULL && node->typeinfo->freefunc) {
                node->typeinfo->freefunc(node);
        }