Fixed crash in OFF Reader with empty lines (Thanks to R.Schneider for the fix)

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@395 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2011-06-15 06:41:52 +00:00
parent c1017f5a08
commit 92d0d9b3b6

View File

@@ -365,9 +365,9 @@ int _OFFReader_::getColorType(std::string& _line, bool _texCoordsAvailable) cons
return 0;
//first remove spaces at start/end of the line
while (std::isspace(_line[0]))
while (_line.size() > 0 && std::isspace(_line[0]))
_line = _line.substr(1);
while (std::isspace(_line[ _line.length()-1 ]))
while (_line.size() > 0 && std::isspace(_line[ _line.length()-1 ]))
_line = _line.substr(0, _line.length()-1);
//count the remaining items in the line