- 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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user