summaryrefslogtreecommitdiff
path: root/indra/llprimitive/llmodel.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-10 10:30:37 +0300
committerGitHub <noreply@github.com>2024-04-10 10:30:37 +0300
commit5af93ff0d53606db3dca727a8cd1b73d7c37d70b (patch)
tree2deaa98bcd99fd2860da758a92816c3bdb838acd /indra/llprimitive/llmodel.cpp
parenta902138de15067a86a6aeb02fdabd094873da0b2 (diff)
parent0acee937f55e6d1a198be2549d5cb55a0403dd4d (diff)
Merge pull request #1177 from secondlife/marchcat/c-merge
Release (Maint W) -> Maint C merge
Diffstat (limited to 'indra/llprimitive/llmodel.cpp')
-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 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();