fix crash with path conversion, not all materials have nodes
authorAntony Riakiotakis <kalast@gmail.com>
Tue, 27 Nov 2012 17:21:58 +0000 (17:21 +0000)
committerAntony Riakiotakis <kalast@gmail.com>
Tue, 27 Nov 2012 17:21:58 +0000 (17:21 +0000)
source/blender/blenlib/intern/bpath.c

index b1da53ace30a258e3b277b46cca2df4d74b4d233..8209ce7e541688992c7f05e7f4e99394c75c893d 100644 (file)
@@ -499,12 +499,15 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
                {
                        Material *ma = (Material *)id;
                        bNodeTree *ntree = ma->nodetree;
-                       bNode *node;
 
-                       for (node = ntree->nodes.first; node; node = node->next) {
-                               if (node->type == SH_NODE_SCRIPT) {
-                                       NodeShaderScript *nss = (NodeShaderScript *)node->storage;
-                                       rewrite_path_fixed(nss->filepath, visit_cb, absbase, bpath_user_data);
+                       if(ntree) {
+                               bNode *node;
+
+                               for (node = ntree->nodes.first; node; node = node->next) {
+                                       if (node->type == SH_NODE_SCRIPT) {
+                                               NodeShaderScript *nss = (NodeShaderScript *)node->storage;
+                                               rewrite_path_fixed(nss->filepath, visit_cb, absbase, bpath_user_data);
+                                       }
                                }
                        }
                        break;