removed no faces crash

This commit is contained in:
granzuglia 2011-03-15 16:40:08 +00:00
parent e66769545e
commit d95b28dff4
1 changed files with 7 additions and 5 deletions

View File

@ -615,8 +615,9 @@ namespace io {
static bool GetHeader(const char * filename,std::vector<std::string>& nameV, std::vector<std::string>& nameF, unsigned int & vertSize, unsigned int &faceSize,vcg::Box3f & bbox,int & mask){ static bool GetHeader(const char * filename,std::vector<std::string>& nameV, std::vector<std::string>& nameF, unsigned int & vertSize, unsigned int &faceSize,vcg::Box3f & bbox,int & mask){
F() = fopen(filename,"rb"); F() = fopen(filename,"rb");
return GetHeader(nameV, nameF, vertSize, faceSize,bbox,mask); bool res = GetHeader(nameV, nameF, vertSize, faceSize,bbox,mask);
fclose(F()); fclose(F());
return res;
} }
public: public:
@ -733,7 +734,8 @@ namespace io {
AttrAll<OpenMeshType,A0,A1,A2,A3,A4>::template AddAttrib<2>(m,_string.c_str(),sz,data); AttrAll<OpenMeshType,A0,A1,A2,A3,A4>::template AddAttrib<2>(m,_string.c_str(),sz,data);
Free(data); Free(data);
} }
if(!m.face.empty()){
if(FaceType::HasVFAdjacency()) if(FaceType::HasVFAdjacency())
for(vi = m.vert.begin(); vi != m.vert.end(); ++vi){ for(vi = m.vert.begin(); vi != m.vert.end(); ++vi){
(*vi).VFp() = (*vi).VFp()-(FaceType*)offsetF+ &m.face[0]; (*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(1) = (*fi).VFp(1)-(FaceType*)offsetF+ &m.face[0];
(*fi).VFp(2) = (*fi).VFp(2)-(FaceType*)offsetF+ &m.face[0]; (*fi).VFp(2) = (*fi).VFp(2)-(FaceType*)offsetF+ &m.face[0];
} }
}
fclose(F()); fclose(F());
return VMI_NO_ERROR; // zero is the standard (!) code of success return VMI_NO_ERROR; // zero is the standard (!) code of success
} }
}; // end class }; // end class