From 92d0d9b3b6eedca2720db2a19d55f0756a1afcda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 15 Jun 2011 06:41:52 +0000 Subject: [PATCH] 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 --- src/OpenMesh/Core/IO/reader/OFFReader.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenMesh/Core/IO/reader/OFFReader.cc b/src/OpenMesh/Core/IO/reader/OFFReader.cc index e36ab1bf..5b3f3027 100644 --- a/src/OpenMesh/Core/IO/reader/OFFReader.cc +++ b/src/OpenMesh/Core/IO/reader/OFFReader.cc @@ -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