Commit 71fa94b3 authored by Anchor Linden's avatar Anchor Linden
Browse files

[MAINT-8693] - fix null check

parent 0a36c8d3
......@@ -184,7 +184,7 @@ void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp)
{
LLTexLayerSet *layer_set = NULL;
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te);
if (texture_dict->mIsUsedByBakedTexture)
if (texture_dict && texture_dict->mIsUsedByBakedTexture)
{
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
......@@ -197,7 +197,7 @@ void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp)
}
else
{
LL_ERRS() << "could not find layerset for LTO in wearable!" << LL_ENDL;
LL_WARNS() << "could not find layerset for LTO in wearable!" << LL_ENDL;
}
}
......
......@@ -78,7 +78,7 @@ static void update_texture_ctrl(LLVOAvatar* avatarp,
{
LLUUID id = IMG_DEFAULT_AVATAR;
const LLAvatarAppearanceDictionary::TextureEntry* tex_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture(te);
if (tex_entry->mIsLocalTexture)
if (tex_entry && tex_entry->mIsLocalTexture)
{
if (avatarp->isSelf())
{
......@@ -96,7 +96,7 @@ static void update_texture_ctrl(LLVOAvatar* avatarp,
}
else
{
id = avatarp->getTE(te)->getID();
id = tex_entry ? avatarp->getTE(te)->getID() : IMG_DEFAULT_AVATAR;
}
//id = avatarp->getTE(te)->getID();
if (id == IMG_DEFAULT_AVATAR)
......
......@@ -301,7 +301,7 @@ void LLViewerWearable::setTexturesToDefaults()
LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index) const
{
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index);
const std::string &default_image_name = texture_dict->mDefaultImageName;
const std::string &default_image_name = texture_dict ? texture_dict->mDefaultImageName : "";
if (default_image_name == "")
{
return IMG_DEFAULT_AVATAR;
......
......@@ -1007,7 +1007,7 @@ void LLVOAvatar::dumpBakedStatus()
const ETextureIndex index = baked_dict->mTextureIndex;
if (!inst->isTextureDefined(index))
{
LL_CONT << " " << LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mName;
LL_CONT << " " << LLAvatarAppearanceDictionary::getInstance()->getTexture(index) ? LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mName : "";
}
}
LL_CONT << " ) " << inst->getUnbakedPixelAreaRank();
......@@ -4715,7 +4715,7 @@ void LLVOAvatar::collectLocalTextureUUIDs(std::set<LLUUID>& ids) const
if (imagep)
{
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)texture_index);
if (texture_dict->mIsLocalTexture)
if (texture_dict && texture_dict->mIsLocalTexture)
{
ids.insert(imagep->getID());
}
......@@ -4872,8 +4872,8 @@ void LLVOAvatar::updateTextures()
if (imagep)
{
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)texture_index);
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
if (texture_dict->mIsLocalTexture)
const EBakedTextureIndex baked_index = texture_dict ? texture_dict->mBakedTextureIndex : EBakedTextureIndex::BAKED_NUM_INDICES;
if (texture_dict && texture_dict->mIsLocalTexture)
{
addLocalTextureStats((ETextureIndex)texture_index, imagep, texel_area_ratio, render_avatar, mBakedTextureDatas[baked_index].mIsUsed);
}
......
......@@ -2606,6 +2606,8 @@ void LLVOAvatarSelf::requestLayerSetUpdate(ETextureIndex index )
if( mUpperBodyLayerSet )
mUpperBodyLayerSet->requestUpdate(); */
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index);
if (!texture_dict)
return;
if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture)
return;
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
......@@ -2622,7 +2624,7 @@ LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const
case TEX_HEAD_BODYPAINT:
return mHeadLayerSet; */
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index);
if (texture_dict->mIsUsedByBakedTexture)
if (texture_dict && texture_dict->mIsUsedByBakedTexture)
{
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
return getLayerSet(baked_index);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment