From d95b28dff4aa9a50cc07b5c4737a65f45420fc3d Mon Sep 17 00:00:00 2001 From: granzuglia Date: Tue, 15 Mar 2011 16:40:08 +0000 Subject: [PATCH] removed no faces crash --- wrap/io_trimesh/import_vmi.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wrap/io_trimesh/import_vmi.h b/wrap/io_trimesh/import_vmi.h index efdd4366..0eca57a3 100644 --- a/wrap/io_trimesh/import_vmi.h +++ b/wrap/io_trimesh/import_vmi.h @@ -615,8 +615,9 @@ namespace io { static bool GetHeader(const char * filename,std::vector& nameV, std::vector& nameF, unsigned int & vertSize, unsigned int &faceSize,vcg::Box3f & bbox,int & mask){ F() = fopen(filename,"rb"); - return GetHeader(nameV, nameF, vertSize, faceSize,bbox,mask); + bool res = GetHeader(nameV, nameF, vertSize, faceSize,bbox,mask); fclose(F()); + return res; } public: @@ -733,7 +734,8 @@ namespace io { AttrAll::template AddAttrib<2>(m,_string.c_str(),sz,data); Free(data); } - + + if(!m.face.empty()){ if(FaceType::HasVFAdjacency()) for(vi = m.vert.begin(); vi != m.vert.end(); ++vi){ (*vi).VFp() = (*vi).VFp()-(FaceType*)offsetF+ &m.face[0]; @@ -761,9 +763,9 @@ namespace io { (*fi).VFp(1) = (*fi).VFp(1)-(FaceType*)offsetF+ &m.face[0]; (*fi).VFp(2) = (*fi).VFp(2)-(FaceType*)offsetF+ &m.face[0]; } - - fclose(F()); - return VMI_NO_ERROR; // zero is the standard (!) code of success + } + fclose(F()); + return VMI_NO_ERROR; // zero is the standard (!) code of success } }; // end class