From c969932a1593ef94326afce4e3ab746969cd6e57 Mon Sep 17 00:00:00 2001
From: ruslantproductengine <ruslantproductengine@lindenlab.com>
Date: Wed, 15 Nov 2017 15:45:08 +0200
Subject: [PATCH] MAINT-6645 - Improvement - Agents that render as jelly dolls
 should have their attachments render at 0 LoD to prevent loading higher LoD
 complexity in memory thus deterring crashes. Stability improve.

---
 indra/newview/llvovolume.cpp | 2 ++
 indra/newview/llvovolume.h   | 1 +
 2 files changed, 3 insertions(+)

diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 4ea3c1b56bf..1ef3d85eb31 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -5374,6 +5374,8 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
 			if (drawablep && !drawablep->isDead() && drawablep->isState(LLDrawable::REBUILD_ALL) && !drawablep->isState(LLDrawable::RIGGED) )
 			{
 				LLVOVolume* vobj = drawablep->getVOVolume();
+				if (vobj->isNoLOD()) continue;
+
 				vobj->preRebuild();
 
 				if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 2d9315df702..f9d04844fc2 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -129,6 +129,7 @@ class LLVOVolume : public LLViewerObject
 	/*virtual*/	BOOL	setParent(LLViewerObject* parent);
 				S32		getLOD() const						{ return mLOD; }
 				void	setNoLOD()							{ mLOD = NO_LOD; mLODChanged = TRUE; }
+				bool	isNoLOD() const						{ return NO_LOD == mLOD; }
 	const LLVector3		getPivotPositionAgent() const;
 	const LLMatrix4&	getRelativeXform() const				{ return mRelativeXform; }
 	const LLMatrix3&	getRelativeXformInvTrans() const		{ return mRelativeXformInvTrans; }
-- 
GitLab