A few nullchecks, and removal of pointless uint < 0 bounds checks.

This commit is contained in:
Shyotl
2012-08-30 02:52:10 -05:00
committed by Siana Gearz
parent fefb40bda2
commit 6ec4c65f04
3 changed files with 11 additions and 6 deletions

View File

@@ -64,7 +64,7 @@ void LLFontBitmapCache::init(S32 num_components,
LLImageRaw *LLFontBitmapCache::getImageRaw(U32 bitmap_num) const LLImageRaw *LLFontBitmapCache::getImageRaw(U32 bitmap_num) const
{ {
if ((bitmap_num < 0) || (bitmap_num >= mImageRawVec.size())) if (bitmap_num >= mImageRawVec.size())
return NULL; return NULL;
return mImageRawVec[bitmap_num]; return mImageRawVec[bitmap_num];
@@ -72,7 +72,7 @@ LLImageRaw *LLFontBitmapCache::getImageRaw(U32 bitmap_num) const
LLImageGL *LLFontBitmapCache::getImageGL(U32 bitmap_num) const LLImageGL *LLFontBitmapCache::getImageGL(U32 bitmap_num) const
{ {
if ((bitmap_num < 0) || (bitmap_num >= mImageGLVec.size())) if (bitmap_num >= mImageGLVec.size())
return NULL; return NULL;
return mImageGLVec[bitmap_num]; return mImageGLVec[bitmap_num];

View File

@@ -758,9 +758,13 @@ BOOL LLImagePreviewAvatar::render()
// make sure alpha=0 shows avatar material color // make sure alpha=0 shows avatar material color
LLGLDisable no_blend(GL_BLEND); LLGLDisable no_blend(GL_BLEND);
LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool(); LLFace* face = avatarp->mDrawable->getFace(0);
gPipeline.enableLightsPreview(); if (face)
avatarPoolp->renderAvatars(avatarp); // renders only one avatar {
LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)face->getPool();
gPipeline.enableLightsPreview();
avatarPoolp->renderAvatars(avatarp); // renders only one avatar
}
} }
gGL.color4f(1,1,1,1); gGL.color4f(1,1,1,1);

View File

@@ -245,7 +245,8 @@ BOOL LLVisualParamHint::render()
LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE); LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
if (gAgentAvatarp->mDrawable.notNull()) if (gAgentAvatarp->mDrawable.notNull() &&
gAgentAvatarp->mDrawable->getFace(0))
{ {
LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)gAgentAvatarp->mDrawable->getFace(0)->getPool(); LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)gAgentAvatarp->mDrawable->getFace(0)->getPool();
LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);