Prevent potential crasher, commonEffects could be empty.

This commit is contained in:
Nathan Letwory
2011-09-04 02:12:03 +00:00
parent 103b06d4df
commit caa1acb6b1

View File

@@ -1059,6 +1059,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
const COLLADAFW::UniqueId & matuid = matBinds[j].getReferencedMaterial(); const COLLADAFW::UniqueId & matuid = matBinds[j].getReferencedMaterial();
const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) (FW_object_map[matuid]); const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) (FW_object_map[matuid]);
const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects();
if(!commonEffects.empty()) {
COLLADAFW::EffectCommon *efc = commonEffects[0]; COLLADAFW::EffectCommon *efc = commonEffects[0];
types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS); types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS);
types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR); types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR);
@@ -1067,6 +1068,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
types->material = setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR); types->material = setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR);
} }
} }
}
return types; return types;
} }