projects
/
platform
/
upstream
/
assimp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4b15dfd
)
Check for std::string::npos before applying std::string::substr
author
John Senneker
<johns@matterandform.net>
Tue, 18 Oct 2016 14:48:47 +0000
(10:48 -0400)
committer
John Senneker
<johns@matterandform.net>
Tue, 18 Oct 2016 14:48:47 +0000
(10:48 -0400)
code/ObjFileParser.cpp
patch
|
blob
|
history
diff --git
a/code/ObjFileParser.cpp
b/code/ObjFileParser.cpp
index
7859563
..
e732edd
100644
(file)
--- 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")