summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-10 06:57:52 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-10 07:08:25 +0300
commit84dfe55810815e8c274044cea5c81aaed89a787f (patch)
tree4e499acfe5617682c5eca52998b5c10cdac8609a /indra/llprimitive
parent16e638db975278f6018fe1e21ba1954b7f159149 (diff)
parentda9a1dcb55548a249ff7a1255f3e518696b81245 (diff)
Merge branch 'main' into marchcat/y-merge
# Conflicts: # autobuild.xml # indra/llcommon/llsys.cpp
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/llmodel.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index ae81f06e84..7b0d2632aa 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -1042,7 +1042,12 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
weight_map::iterator iterPos = mSkinWeights.begin();
weight_map::iterator iterEnd = mSkinWeights.end();
- llassert(!mSkinWeights.empty());
+ if (mSkinWeights.empty())
+ {
+ // function calls iter->second on all return paths
+ // everything that calls this function should precheck that there is data.
+ LL_ERRS() << "called getJointInfluences with empty weights list" << LL_ENDL;
+ }
for ( ; iterPos!=iterEnd; ++iterPos )
{
@@ -1069,11 +1074,16 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
const F32 epsilon = 1e-5f;
weight_map::iterator iter_up = mSkinWeights.lower_bound(pos);
weight_map::iterator iter_down = iter_up;
- if (iter_up != mSkinWeights.end())
- {
- iter_down = ++iter_up;
- }
- weight_map::iterator best = iter_up;
+ weight_map::iterator best = iter_up;
+ if (iter_up != mSkinWeights.end())
+ {
+ iter_down = ++iter_up;
+ }
+ else
+ {
+ // Assumes that there is at least one element
+ --best;
+ }
F32 min_dist = (iter->first - pos).magVec();