[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48070] trunk/blender/source/blender/ blenloader/intern/readfile.c: Fix #31646, somehow a 2. 62 file output node can have NULL storage pointer.

Lukas Toenne lukas.toenne at googlemail.com
Tue Jun 19 09:47:02 CEST 2012


Revision: 48070
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48070
Author:   lukastoenne
Date:     2012-06-19 07:46:45 +0000 (Tue, 19 Jun 2012)
Log Message:
-----------
Fix #31646, somehow a 2.62 file output node can have NULL storage pointer. Not sure how this can happen, but added checks in do_versions to make sure the file doesn't crash. Paths will probably have to be reset though.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2012-06-19 06:11:52 UTC (rev 48069)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2012-06-19 07:46:45 UTC (rev 48070)
@@ -6787,17 +6787,24 @@
 			
 			node->storage = nimf;
 			
-			/* split off filename from the old path, to be used as socket sub-path */
-			BLI_split_dirfile(old_data->name, basepath, filename, sizeof(basepath), sizeof(filename));
+			/* looks like storage data can be messed up somehow, stupid check here */
+			if (old_data) {
+				/* split off filename from the old path, to be used as socket sub-path */
+				BLI_split_dirfile(old_data->name, basepath, filename, sizeof(basepath), sizeof(filename));
+				
+				BLI_strncpy(nimf->base_path, basepath, sizeof(nimf->base_path));
+				nimf->format = old_data->im_format;
+			}
+			else {
+				basepath[0] = '\0';
+				BLI_strncpy(filename, old_image->name, sizeof(filename));
+			}
 			
-			BLI_strncpy(nimf->base_path, basepath, sizeof(nimf->base_path));
-			nimf->format = old_data->im_format;
-			
 			/* if z buffer is saved, change the image type to multilayer exr.
 			 * XXX this is slightly messy, Z buffer was ignored before for anything but EXR and IRIS ...
 			 * i'm just assuming here that IRIZ means IRIS with z buffer ...
 			 */
-			if (ELEM(old_data->im_format.imtype, R_IMF_IMTYPE_IRIZ, R_IMF_IMTYPE_OPENEXR)) {
+			if (old_data && ELEM(old_data->im_format.imtype, R_IMF_IMTYPE_IRIZ, R_IMF_IMTYPE_OPENEXR)) {
 				char sockpath[FILE_MAX];
 				
 				nimf->format.imtype = R_IMF_IMTYPE_MULTILAYER;
@@ -6832,7 +6839,8 @@
 			
 			nodeRemoveSocket(ntree, node, old_image);
 			nodeRemoveSocket(ntree, node, old_z);
-			MEM_freeN(old_data);
+			if (old_data)
+				MEM_freeN(old_data);
 		}
 		else if (node->type==CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED) {
 			NodeImageMultiFile *nimf = node->storage;




More information about the Bf-blender-cvs mailing list