diff options
author | Brad Linden <brad@lindenlab.com> | 2024-04-09 14:17:34 -0700 |
---|---|---|
committer | Brad Linden <brad@lindenlab.com> | 2024-04-09 14:17:34 -0700 |
commit | 5a47a3cb2366b9da9a595d37c88703497e111005 (patch) | |
tree | 1e255fecfda9bf1582d8d76a48e950a561a811a1 /indra/llprimitive | |
parent | 03c75201605067b0e97aba0333f8ea6d45d10804 (diff) | |
parent | da9a1dcb55548a249ff7a1255f3e518696b81245 (diff) |
Merge remote-tracking branch 'origin/main' into release/materials_featurette
Diffstat (limited to 'indra/llprimitive')
-rw-r--r-- | indra/llprimitive/llmodel.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 99a5697a84..d56ffdc317 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1041,7 +1041,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 ) { @@ -1068,11 +1073,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(); |