From 0015cfae78f52c22472b60f58bf926fb1b563122 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 2 Jan 2020 11:30:33 +0100 Subject: [PATCH] Guard against null-pointer crash --- indra/newview/llvoavatar.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e65898f014..2d93dc259b 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -10771,18 +10771,21 @@ void LLVOAvatar::updateRegion(LLViewerRegion *regionp) // BOM constrain number of bake requests when BOM not supported, // TEX_HEAD_TATTOO and BAKED_LEFT_ARM are the first new entries - sMaxBakes = gAgent.getRegion()->bakesOnMeshEnabled()?BAKED_NUM_INDICES:BAKED_LEFT_ARM; - - if(!gSavedSettings.getBOOL("CurrentlyUsingBakesOnMesh") != getRegion()->bakesOnMeshEnabled()) + if (gAgent.getRegion()) { + sMaxBakes = gAgent.getRegion()->bakesOnMeshEnabled() ? BAKED_NUM_INDICES : BAKED_LEFT_ARM; + + if (!gSavedSettings.getBOOL("CurrentlyUsingBakesOnMesh") != getRegion()->bakesOnMeshEnabled()) + { // force a rebake when the last grid we were on (including previous login) had different BOM support // This replicates forceAppearanceUpdate rather than pulling in the whole of llavatarself. - if(!LLGridManager::instance().isInSecondLife()) - { - doAfterInterval(boost::bind(&LLVOAvatarSelf::forceBakeAllTextures, gAgentAvatarp.get(), true), 5.0); + if (!LLGridManager::instance().isInSecondLife()) + { + doAfterInterval(boost::bind(&LLVOAvatarSelf::forceBakeAllTextures, gAgentAvatarp.get(), true), 5.f); + } + // update the setting even if we are in SL so that switch SL to OS and back + gSavedSettings.setBOOL("CurrentlyUsingBakesOnMesh", getRegion()->bakesOnMeshEnabled()); } - // update the setting even if we are in SL so that switch SL to OS and back - gSavedSettings.setBOOL("CurrentlyUsingBakesOnMesh", getRegion()->bakesOnMeshEnabled()); } // LLViewerObject::updateRegion(regionp);