added a check for empty lines in obj (to avoid out of bound accesses)

This commit is contained in:
Paolo Cignoni 2016-11-24 18:02:07 +01:00
parent 831639d819
commit 095a697535
1 changed files with 2 additions and 2 deletions

View File

@ -745,8 +745,8 @@ namespace vcg {
std::getline(stream, line);
// We have to manage backspace terminated lines,
// joining them together before parsing them
if(line.back()==13) line.pop_back();
while(line.back()=='\\') {
if(!line.empty() && line.back()==13) line.pop_back();
while(!line.empty() && line.back()=='\\') {
std::string tmpLine;
std::getline(stream, tmpLine);
if(tmpLine.back()==13) line.pop_back();