summaryrefslogtreecommitdiff
path: root/indra/llprimitive/llmodel.cpp
diff options
context:
space:
mode:
authorStinson Linden <stinson@lindenlab.com>2014-05-19 22:19:55 +0100
committerStinson Linden <stinson@lindenlab.com>2014-05-19 22:19:55 +0100
commitbabd89b77050ab49166f2fbd6d460884070140d9 (patch)
treedd3039e009f3e0f7ca2de578f4599e79ca15a1dc /indra/llprimitive/llmodel.cpp
parent08e83a341e76de8fa4d8c4a974edbe3e0bd1c128 (diff)
parent644ca6a0f8a7759119814f88df93b8e838321a12 (diff)
Pull and merge from ssh://hg@bitbucket.org/lindenlab/viewer-release.
Diffstat (limited to 'indra/llprimitive/llmodel.cpp')
-rwxr-xr-xindra/llprimitive/llmodel.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 847b1d8385..b0456e3ccf 100755
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -170,6 +170,11 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
return LLModel::BAD_ELEMENT;
}
+ if (!pos_source)
+ {
+ llwarns << "Unable to process mesh without position data; invalid model; invalid model." << llendl;
+ return LLModel::BAD_ELEMENT;
+ }
domPRef p = tri->getP();
domListOfUInts& idx = p->getValue();
@@ -179,19 +184,22 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
domListOfFloats& tc = tc_source ? tc_source->getFloat_array()->getValue() : dummy ;
domListOfFloats& n = norm_source ? norm_source->getFloat_array()->getValue() : dummy ;
- if (pos_source)
- {
- face.mExtents[0].set(v[0], v[1], v[2]);
- face.mExtents[1].set(v[0], v[1], v[2]);
- }
-
LLVolumeFace::VertexMapData::PointMap point_map;
-
+
U32 index_count = idx.getCount();
U32 vertex_count = pos_source ? v.getCount() : 0;
U32 tc_count = tc_source ? tc.getCount() : 0;
U32 norm_count = norm_source ? n.getCount() : 0;
+ if (vertex_count == 0)
+ {
+ llwarns << "Unable to process mesh with empty position array; invalid model." << llendl;
+ return LLModel::BAD_ELEMENT;
+ }
+
+ face.mExtents[0].set(v[0], v[1], v[2]);
+ face.mExtents[1].set(v[0], v[1], v[2]);
+
for (U32 i = 0; i < index_count; i += idx_stride)
{
LLVolumeFace::VertexData cv;