Check for std::string::npos before applying std::string::substr
parent
4b15dfd9af
commit
acd2802f22
|
@ -185,7 +185,11 @@ void ObjFileParser::parseFile()
|
|||
std::string name;
|
||||
|
||||
getName(m_DataIt, m_DataItEnd, name);
|
||||
name = name.substr(0, name.find(" "));
|
||||
|
||||
size_t nextSpace = name.find(" ");
|
||||
if (nextSpace != std::string::npos)
|
||||
name = name.substr(0, nextSpace);
|
||||
|
||||
if (name == "mg")
|
||||
getGroupNumberAndResolution();
|
||||
else if(name == "mtllib")
|
||||
|
|
Loading…
Reference in New Issue