From 3e380c9a8498fa08eec60f81af0a42f06a8fb759 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 22 Jan 2018 18:11:12 +0200 Subject: [PATCH] MAINT-8208 [Mac] Viewer crashes when uploading certain mesh model after enabling "Include skin weight" --- indra/llprimitive/llmodel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 310b6bd91f..ffa54b546d 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1034,8 +1034,11 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos) { //no exact match found, get closest point const F32 epsilon = 1e-5f; weight_map::iterator iter_up = mSkinWeights.lower_bound(pos); - weight_map::iterator iter_down = ++iter_up; - + weight_map::iterator iter_down = iter_up; + if (iter_up != mSkinWeights.end()) + { + iter_down = ++iter_up; + } weight_map::iterator best = iter_up; // FIRE-9251; There is no way iter can be valid here, otherwise we had hit the if branch and not the else branch.