[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39902] trunk/blender/source/blender/ collada/AnimationImporter.cpp: Prevent potential crasher, commonEffects could be empty.

Nathan Letwory nathan at letworyinteractive.com
Sun Sep 4 04:12:07 CEST 2011


Revision: 39902
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39902
Author:   jesterking
Date:     2011-09-04 02:12:03 +0000 (Sun, 04 Sep 2011)
Log Message:
-----------
Prevent potential crasher, commonEffects could be empty.

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

Modified: trunk/blender/source/blender/collada/AnimationImporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/AnimationImporter.cpp	2011-09-04 01:42:47 UTC (rev 39901)
+++ trunk/blender/source/blender/collada/AnimationImporter.cpp	2011-09-04 02:12:03 UTC (rev 39902)
@@ -1059,12 +1059,14 @@
 			const COLLADAFW::UniqueId & matuid = matBinds[j].getReferencedMaterial();
 			const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) (FW_object_map[matuid]);
 			const COLLADAFW::CommonEffectPointerArray& commonEffects  =  ef->getCommonEffects();
-			COLLADAFW::EffectCommon *efc = commonEffects[0];
-			types->material =  setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS);
-			types->material =  setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR);
-			types->material =  setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR);
-			// types->material =  setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY);
-			types->material =  setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR);
+			if(!commonEffects.empty()) {
+				COLLADAFW::EffectCommon *efc = commonEffects[0];
+				types->material =  setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS);
+				types->material =  setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR);
+				types->material =  setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR);
+				// types->material =  setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY);
+				types->material =  setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR);
+			}
 		}
 	}
 	return types;




More information about the Bf-blender-cvs mailing list