- fixed crash on reading obj with material file

This commit is contained in:
granzuglia 2014-02-21 15:16:40 +00:00
parent a472e201a3
commit 89f4146e2c
1 changed files with 2 additions and 2 deletions

View File

@ -539,14 +539,14 @@ namespace vcg {
} }
} }
else if (header.compare("mtllib")==0) // material library else if ((header.compare("mtllib")==0) && (tokens.size() > 1)) // material library
{ {
// obtain the name of the file containing materials library // obtain the name of the file containing materials library
std::string materialFileName = tokens[1]; std::string materialFileName = tokens[1];
if (!LoadMaterials( materialFileName.c_str(), materials, m.textures)) if (!LoadMaterials( materialFileName.c_str(), materials, m.textures))
result = E_MATERIAL_FILE_NOT_FOUND; result = E_MATERIAL_FILE_NOT_FOUND;
} }
else if (header.compare("usemtl")==0) // material usage else if ((header.compare("usemtl")==0) && (tokens.size() > 1)) // material usage
{ {
std::string materialName = tokens[1]; std::string materialName = tokens[1];
bool found = false; bool found = false;