- PLY Reader: Fix file load for ASCII PLY without a newline at the end of the file (Thanks to Mathieu Lamarre for the patch )

closes #64
This commit is contained in:
Jan Möbius
2019-02-04 08:52:41 +01:00
parent 471874bce5
commit 4c2c8f34c0
2 changed files with 9 additions and 8 deletions

View File

@@ -306,6 +306,14 @@ bool _PLYReader_::read_ascii(std::istream& _in, BaseImporter& _bi, const Options
for (std::vector<ElementInfo>::iterator e_it = elements_.begin(); e_it != elements_.end(); ++e_it)
{
if (_in.eof()) {
if (err_enabled)
omerr().enable();
omerr() << "Unexpected end of file while reading." << std::endl;
return false;
}
if (e_it->element_== VERTEX)
{
// read vertices:
@@ -475,14 +483,6 @@ bool _PLYReader_::read_ascii(std::istream& _in, BaseImporter& _bi, const Options
}
}
if (_in.eof()) {
if (err_enabled)
omerr().enable();
omerr() << "Unexpected end of file while reading." << std::endl;
return false;
}
if(e_it->element_== FACE)
// stop reading after the faces since additional elements are not preserved anyway
break;