removed bug causing crash when reading a emtpy off

This commit is contained in:
Paolo Cignoni 2014-09-07 21:36:52 +00:00
parent 053b649ed2
commit 9fa2820419
1 changed files with 2 additions and 1 deletions

View File

@ -114,6 +114,7 @@ public:
std::vector< std::string > tokens; std::vector< std::string > tokens;
TokenizeNextLine(stream, tokens); TokenizeNextLine(stream, tokens);
if(tokens.empty()) return InvalidFile_MissingOFF;
bool isNormalDefined = false; bool isNormalDefined = false;
bool isColorDefined = false; bool isColorDefined = false;
@ -597,7 +598,7 @@ protected:
std::string line; std::string line;
do do
std::getline(stream, line, '\n'); std::getline(stream, line, '\n');
while (line[0] == '#' || line.length()==0 || line[0]=='\r'); while ((line[0] == '#' || line.length()==0 || line[0]=='\r' ) && (!stream.eof()));
size_t from = 0; size_t from = 0;
size_t to = 0; size_t to = 0;