[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48775] trunk/blender/source/blender/ collada/ImageExporter.cpp: Fixed an exception during image export when a source image does not exist in the file system

Gaia Clary gaia.clary at machinimatrix.org
Tue Jul 10 00:41:44 CEST 2012


Revision: 48775
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48775
Author:   gaiaclary
Date:     2012-07-09 22:41:44 +0000 (Mon, 09 Jul 2012)
Log Message:
-----------
Fixed an exception during image export when a source image does not exist in the file system

Modified Paths:
--------------
    trunk/blender/source/blender/collada/ImageExporter.cpp

Modified: trunk/blender/source/blender/collada/ImageExporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/ImageExporter.cpp	2012-07-09 22:39:35 UTC (rev 48774)
+++ trunk/blender/source/blender/collada/ImageExporter.cpp	2012-07-09 22:41:44 UTC (rev 48775)
@@ -63,6 +63,11 @@
 	if (not_yet_exported) {
 
 		ImBuf *imbuf       = BKE_image_get_ibuf(image, NULL);
+		if(!imbuf) {
+			fprintf(stderr, "Collada export: image does not exist:\n%s\n", image->name);
+			return;
+		}
+
 		bool  is_dirty     = imbuf->userflags & IB_BITMAPDIRTY;
 
 		ImageFormatData imageFormat;
@@ -100,6 +105,7 @@
 
 			if (BKE_imbuf_write_as(imbuf, export_path, &imageFormat, true) == 0) {
 				fprintf(stderr, "Collada export: Cannot export image to:\n%s\n", export_path);
+				return;
 			}
 			BLI_strncpy(export_path, export_file, sizeof(export_path));
 		}
@@ -119,6 +125,7 @@
 
 				if (BLI_copy(source_path, export_path) != 0) {
 					fprintf(stderr, "Collada export: Cannot copy image:\n source:%s\ndest :%s\n", source_path, export_path);
+					return;
 				}
 
 				BLI_strncpy(export_path, export_file, sizeof(export_path));




More information about the Bf-blender-cvs mailing list