From fe2f9aed2543615cb6d314ab01b76f0eba9d6ccc Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Mon, 7 Mar 2022 19:39:13 +0200
Subject: [PATCH] SL-16721 Crash on idleUpdateMisc #2

---
 indra/newview/llvoavatar.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 31035f666d9..5ee661f6c0f 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2817,11 +2817,15 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
 				 ++attachment_iter)
 			{
 				LLViewerObject* attached_object = attachment_iter->get();
-				BOOL visibleAttachment = visible || (attached_object && 
+				BOOL visibleAttachment = visible || (attached_object && attached_object->mDrawable.notNull() &&
 													 !(attached_object->mDrawable->getSpatialBridge() &&
 													   attached_object->mDrawable->getSpatialBridge()->getRadius() < 2.0));
 				
-				if (visibleAttachment && attached_object && !attached_object->isDead() && attachment->getValid())
+				if (visibleAttachment
+                    && attached_object
+                    && !attached_object->isDead()
+                    && attachment->getValid()
+                    && attached_object->mDrawable.notNull())
 				{
 
                     //override rigged attachments' octree spatial extents with this avatar's bounding box
-- 
GitLab