From 733cb52240212f4b0f281592eeb8651ed7bdc08a Mon Sep 17 00:00:00 2001 From: Isaak Lim Date: Thu, 26 Sep 2013 13:02:09 +0000 Subject: [PATCH] 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 --- src/OpenMesh/Core/IO/reader/STLReader.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenMesh/Core/IO/reader/STLReader.cc b/src/OpenMesh/Core/IO/reader/STLReader.cc index e8751dd9..c7e258ca 100644 --- a/src/OpenMesh/Core/IO/reader/STLReader.cc +++ b/src/OpenMesh/Core/IO/reader/STLReader.cc @@ -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); }