summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprep <prep@lindenlab.com>2011-07-25 17:42:22 -0400
committerprep <prep@lindenlab.com>2011-07-25 17:42:22 -0400
commit9395bcee52a9786185d90c52a22564b1d975e4ea (patch)
tree02bdf075aede14c3fdc5c0ef7f915da3bf0c6fe2
parent4a04458ff560b139c9adf50092a531eb0729652b (diff)
Fix for sh-2162
-rw-r--r--indra/newview/llfloatermodelpreview.cpp22
1 files changed, 13 insertions, 9 deletions
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());
+ }
}
}
}