diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2011-09-04 06:12:03 +0400 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2011-09-04 06:12:03 +0400 |
commit | caa1acb6b1d6b908e34be31c4b9bd026066b820f (patch) | |
tree | 2d189d3acfe91a0c2057ccd4e0dd3d7c37a204c1 | |
parent | 103b06d4dfe0c5cda0eed2dad8d077e32aa056df (diff) |
Prevent potential crasher, commonEffects could be empty.
-rw-r--r-- | source/blender/collada/AnimationImporter.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index db32664f736..29c356ed8f0 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -1059,12 +1059,14 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD 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; |