From 4bcb7a4a3d9bebc3c543c5514822a7d42cf2d045 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 11 May 2012 13:06:01 +0200 Subject: [PATCH] Fix for crash during disconnect (FIRE-6249) --- indra/newview/llworld.cpp | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 675745369f..8689e4ca46 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1237,22 +1237,33 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positi iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter; - LLVector3d pos_global = pVOAvatar->getPositionGlobal(); - LLUUID uuid = pVOAvatar->getID(); - if( !pVOAvatar->isDead() - && !pVOAvatar->isSelf() - && !uuid.isNull() && - dist_vec_squared(pos_global, relative_to) <= radius_squared) + // FIRE-6249: Check if avatar is valid first before + // doing anything: Fixes crash during disconnect + if (!pVOAvatar->isDead() && !pVOAvatar->isSelf()) { - if(positions != NULL) + // FIRE-6249 + LLVector3d pos_global = pVOAvatar->getPositionGlobal(); + LLUUID uuid = pVOAvatar->getID(); + // FIRE-6249 + //if( !pVOAvatar->isDead() + // && !pVOAvatar->isSelf() + // && !uuid.isNull() && + if (!uuid.isNull() && + // FIRE-6249 + dist_vec_squared(pos_global, relative_to) <= radius_squared) { - positions->push_back(pos_global); - } - if(avatar_ids !=NULL) - { - avatar_ids->push_back(uuid); + if(positions != NULL) + { + positions->push_back(pos_global); + } + if(avatar_ids !=NULL) + { + avatar_ids->push_back(uuid); + } } + // FIRE-6249 } + // FIRE-6249 } // region avatars added for situations where radius is greater than RenderFarClip for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();