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:
@ -734,6 +735,7 @@ namespace io {
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