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();