From 9395bcee52a9786185d90c52a22564b1d975e4ea Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 25 Jul 2011 17:42:22 -0400 Subject: Fix for sh-2162 --- indra/newview/llfloatermodelpreview.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 5ea8dd07ff..62b8d03281 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4967,18 +4967,22 @@ BOOL LLModelPreview::render() if (textures) { - const std::string& binding = instance.mModel->mMaterialList[i]; - const LLImportMaterial& material = instance.mMaterial[binding]; + int materialCnt = instance.mModel->mMaterialList.size(); + if ( i < materialCnt ) + { + const std::string& binding = instance.mModel->mMaterialList[i]; + const LLImportMaterial& material = instance.mMaterial[binding]; - llassert(binding == model->mMaterialList[i]); + llassert(binding == model->mMaterialList[i]); - glColor4fv(material.mDiffuseColor.mV); - if (material.mDiffuseMap.notNull()) - { - if (material.mDiffuseMap->getDiscardLevel() > -1) + glColor4fv(material.mDiffuseColor.mV); + if (material.mDiffuseMap.notNull()) { - gGL.getTexUnit(0)->bind(material.mDiffuseMap, true); - mTextureSet.insert(material.mDiffuseMap.get()); + if (material.mDiffuseMap->getDiscardLevel() > -1) + { + gGL.getTexUnit(0)->bind(material.mDiffuseMap, true); + mTextureSet.insert(material.mDiffuseMap.get()); + } } } } -- cgit v1.2.3