Commit 733cb522 authored by Isaak Lim's avatar Isaak Lim
Browse files

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

git-svn-id: fdac6126-5c0c-442c-9429-916003d36597
parent b643b26f
......@@ -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);
Supports Markdown
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