From fcf2f235b763a4e1e2814685c3086da3933eac74 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Mon, 9 Nov 2015 14:58:26 -0500
Subject: [PATCH] SL-263 FIX - fallback code to prevent crash, won't be invoked
 unless there's a bug somewhere upstream.

---
 indra/newview/llskinningutil.cpp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp
index c32345cbe98..279035d769a 100644
--- a/indra/newview/llskinningutil.cpp
+++ b/indra/newview/llskinningutil.cpp
@@ -232,7 +232,18 @@ void LLSkinningUtil::initSkinningMatrixPalette(
     {
         LLJoint* joint = avatar->getJoint(skin->mJointNames[j]);
         mat[j] = skin->mInvBindMatrix[j];
-        mat[j] *= joint->getWorldMatrix();
+        if (joint)
+        {
+            mat[j] *= joint->getWorldMatrix();
+        }
+        else
+        {
+            // This  shouldn't  happen   -  in  mesh  upload,  skinned
+            // rendering  should  be disabled  unless  all joints  are
+            // valid.  In other  cases of  skinned  rendering, invalid
+            // joints should already have  been removed during remap.
+            LL_WARNS_ONCE("Avatar") << "Rigged to invalid joint name " << skin->mJointNames[j] << LL_ENDL;
+        }
     }
 }
 
-- 
GitLab