[Bf-blender-cvs] [d483a5b] gooseberry: Nicer error handling for unimplemented CustomData layer types.

Lukas Tönne noreply at git.blender.org
Mon Mar 23 13:02:55 CET 2015


Commit: d483a5b1dbf64e65193d2da5c3cf11dde2d23b55
Author: Lukas Tönne
Date:   Mon Mar 9 09:57:26 2015 +0100
Branches: gooseberry
https://developer.blender.org/rBd483a5b1dbf64e65193d2da5c3cf11dde2d23b55

Nicer error handling for unimplemented CustomData layer types.

Instead of failing an assert, simply print an error message and return
gracefully. We don't want Blender crashing because of this.

===================================================================

M	source/blender/pointcache/alembic/abc_customdata.cpp

===================================================================

diff --git a/source/blender/pointcache/alembic/abc_customdata.cpp b/source/blender/pointcache/alembic/abc_customdata.cpp
index cc26f5f..f7c27ef 100644
--- a/source/blender/pointcache/alembic/abc_customdata.cpp
+++ b/source/blender/pointcache/alembic/abc_customdata.cpp
@@ -55,7 +55,7 @@ template <CustomDataType CDTYPE>
 static void write_sample(CustomDataWriter *writer, OCompoundProperty &parent, const std::string &name, void *data, int num_data)
 {
 	/* no implementation available, should not happen */
-	BLI_assert(false);
+	printf("ERROR: CustomData type %s has no write_sample implementation\n", CustomData_layertype_name((int)CDTYPE));
 }
 
 template <>
@@ -101,7 +101,8 @@ template <CustomDataType CDTYPE>
 static PTCReadSampleResult read_sample(CustomDataReader *reader, ICompoundProperty &parent, const ISampleSelector &ss, const std::string &name, void *data, int num_data)
 {
 	/* no implementation available, should not happen */
-	BLI_assert(false);
+	printf("ERROR: CustomData type %s has no read_sample implementation\n", CustomData_layertype_name((int)CDTYPE));
+	return PTC_READ_SAMPLE_INVALID;
 }
 
 template <>




More information about the Bf-blender-cvs mailing list