Fix segfault caused by FBX file with missing face #2614

pull/2620/head
Gordon MacPherson 2019-08-26 22:39:20 +01:00
parent d56198774e
commit c50a4d8ade
1 changed files with 5 additions and 1 deletions

View File

@ -610,8 +610,12 @@ void MeshGeometry::ReadVertexDataMaterials(std::vector<int>& materials_out, cons
const std::string& ReferenceInformationType) const std::string& ReferenceInformationType)
{ {
const size_t face_count = m_faces.size(); const size_t face_count = m_faces.size();
ai_assert(face_count);
if(face_count == 0)
{
return;
}
// materials are handled separately. First of all, they are assigned per-face // materials are handled separately. First of all, they are assigned per-face
// and not per polyvert. Secondly, ReferenceInformationType=IndexToDirect // and not per polyvert. Secondly, ReferenceInformationType=IndexToDirect
// has a slightly different meaning for materials. // has a slightly different meaning for materials.