fixed a bug in the STLReader where normals could be set for invalid face handles

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@963 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Isaak Lim
2013-09-26 13:02:09 +00:00
parent b643b26f2d
commit 733cb52240

View File

@@ -323,7 +323,7 @@ read_stla(std::istream& _in, BaseImporter& _bi, Options& _opt) const
// set the normal if requested
// if a normal was requested but could not be found we unset the option
if (facet_normal) {
if (_opt.face_has_normal())
if (fh.is_valid() && _opt.face_has_normal())
_bi.set_normal(fh, n);
} else
_opt -= Options::FaceNormal;
@@ -432,7 +432,7 @@ read_stlb(std::istream& _in, BaseImporter& _bi, Options& _opt) const
(vhandles[1] != vhandles[2])) {
FaceHandle fh = _bi.add_face(vhandles);
if (_opt.face_has_normal())
if (fh.is_valid() && _opt.face_has_normal())
_bi.set_normal(fh, n);
}