From: John Senneker Date: Tue, 18 Oct 2016 14:48:47 +0000 (-0400) Subject: Check for std::string::npos before applying std::string::substr X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=acd2802f22a9cd937d3d1ec61a29e8a2b20b55ef;p=platform%2Fupstream%2Fassimp.git Check for std::string::npos before applying std::string::substr --- diff --git a/code/ObjFileParser.cpp b/code/ObjFileParser.cpp index 7859563..e732edd 100644 --- a/code/ObjFileParser.cpp +++ b/code/ObjFileParser.cpp @@ -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")