Commit 9da1a2c1 authored by Jan Möbius's avatar Jan Möbius

Fixed crash in offreader with dos line endings. (Thanks to

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@257 fdac6126-5c0c-442c-9429-916003d36597
parent cf91d704
......@@ -355,10 +355,10 @@ int _OFFReader_::getColorType(std::string& _line, bool _texCoordsAvailable) cons
return 0;
//first remove spaces at start/end of the line
while (_line[0] == ' ')
while (std::isspace(_line[0]))
_line = _line.substr(1);
while (_line[ _line.length()-1 ] == ' ')
_line = _line.substr(0, _line.length()-2);
while (std::isspace(_line[ _line.length()-1 ]))
_line = _line.substr(0, _line.length()-1);
//count the remaining items in the line
size_t found;
......@@ -370,7 +370,7 @@ int _OFFReader_::getColorType(std::string& _line, bool _texCoordsAvailable) cons
found=_line.find_first_of(" ",found+1);
}
if (_line != "") count++;
if (!_line.empty()) count++;
if (_texCoordsAvailable) count -= 2;
......
Markdown is supported
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