From 89f4146e2c707d527d8cc772db6160ca2f762bc5 Mon Sep 17 00:00:00 2001 From: granzuglia Date: Fri, 21 Feb 2014 15:16:40 +0000 Subject: [PATCH] - fixed crash on reading obj with material file --- wrap/io_trimesh/import_obj.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wrap/io_trimesh/import_obj.h b/wrap/io_trimesh/import_obj.h index b88ebc3d..67d4837b 100644 --- a/wrap/io_trimesh/import_obj.h +++ b/wrap/io_trimesh/import_obj.h @@ -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 std::string materialFileName = tokens[1]; if (!LoadMaterials( materialFileName.c_str(), materials, m.textures)) 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]; bool found = false;