Commit d7716799 authored by Jan Möbius's avatar Jan Möbius

Improved OBJ Reader to not segfault on problems regarding texture coordinates



git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@96 fdac6126-5c0c-442c-9429-916003d36597
parent 93f7d032
......@@ -430,9 +430,13 @@ read(std::fstream& _in, BaseImporter& _bi, Options& _opt)
value = _bi.n_vertices() + value + 1;
}
assert(!vhandles.empty());
assert((unsigned int)(value-1) < texcoords.size());
_bi.set_texcoord(vhandles.back(), texcoords[value-1]);
face_texcoords.push_back( texcoords[value-1] );
if ( ! texcoords.empty() && (unsigned int)(value-1) < texcoords.size() ) {
_bi.set_texcoord(vhandles.back(), texcoords[value-1]);
face_texcoords.push_back( texcoords[value-1] );
} else {
omerr() << "Error setting Texture coordinates" << std::endl;
}
break;
case 2: // normal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment