From 03e9b737809c4d9def021cf3096a40e0032e789b Mon Sep 17 00:00:00 2001 From: Nicky Date: Tue, 3 Apr 2018 11:13:41 +0200 Subject: [PATCH] A reference being null would be undefined behavior and the compiler will optimize such checks away. Also dereferencing a nullptr beforehand would be undefined behavior too. Replace this with something well formed. --- indra/newview/llface.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 50a4925c37..1a174c21ff 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -983,13 +983,16 @@ void LLFace::getPlanarProjectedParams(LLQuaternion* face_rot, LLVector3* face_po { const LLMatrix4& vol_mat = getWorldMatrix(); const LLVolumeFace& vf = getViewerObject()->getVolume()->getVolumeFace(mTEOffset); - const LLVector4a& normal4a = vf.mNormals[0]; - const LLVector4a& tangent = vf.mTangents[0]; - if (!&tangent) + + if( !vf.mNormals || !vf.mTangents ) { + LL_WARNS( ) << "Volume face without normals or tangents" << LL_ENDL; return; } + const LLVector4a& normal4a = vf.mNormals[0]; + const LLVector4a& tangent = vf.mTangents[0]; + LLVector4a binormal4a; binormal4a.setCross3(normal4a, tangent); binormal4a.mul(tangent.getF32ptr()[3]);