FIRE-9251; make sure there's no iterator used out of the maps valid range.
parent
bd582705f0
commit
e412b7e10f
|
|
@ -1735,9 +1735,22 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
|
|||
weight_map::iterator iter_up = mSkinWeights.lower_bound(pos);
|
||||
weight_map::iterator iter_down = ++iter_up;
|
||||
|
||||
// <FS:ND> FIRE-9251; it can happen than iter_up points at end(), in that case iter_down points to end()+1. Adjust iter_up to end()-1 and iter_down to end then.
|
||||
// This will gurantee we have at least one valid pointer from our map and can use that safely as 'best'.
|
||||
if( mSkinWeights.end() == iter_up )
|
||||
{
|
||||
iter_down = iter_up;
|
||||
--iter_up;
|
||||
}
|
||||
// </FS:ND>
|
||||
|
||||
|
||||
weight_map::iterator best = iter_up;
|
||||
|
||||
F32 min_dist = (iter->first - pos).magVec();
|
||||
// <FS:ND> FIRE-9251; There is no way iter can be valid here, otherwise we had hit the if branch and not the else branch.
|
||||
// F32 min_dist = (iter->first - pos).magVec();
|
||||
F32 min_dist = (best->first - pos).magVec();
|
||||
// </FS:ND>
|
||||
|
||||
bool done = false;
|
||||
while (!done)
|
||||
|
|
|
|||
Loading…
Reference in New Issue