Improvements of OBJ parser robustness.

This commit is contained in:
Vojtech Bubnik 2020-12-17 09:16:53 +01:00
parent ddef084184
commit 7df9f3e422
2 changed files with 5 additions and 1 deletions

View file

@ -70,7 +70,8 @@ bool load_obj(const char *path, TriangleMesh *meshptr)
++ num_normals;
}
}
if (data.vertices[i].coordIdx != -1) {
// Result of obj_parseline() call is not checked, thus not all vertices are necessarily finalized with coord_Idx == -1.
if (i < data.vertices.size() && data.vertices[i].coordIdx != -1) {
// This is a quad. Produce the other triangle.
stl_facet &facet2 = stl.facet_start[i_face++];
facet2.vertex[0] = facet.vertex[0];