[3053648] Obj: segfault when first line is a material.

Add test file to reproduce the issues. Thanks to Ingo Kresse for providing the patch.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@807 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2010-08-27 12:36:02 +00:00
parent c5c5338397
commit cab35c496d
4 changed files with 2515 additions and 0 deletions

View File

@ -633,6 +633,11 @@ void ObjFileParser::createMesh()
// Returns true, if a new mesh must be created.
bool ObjFileParser::needsNewMesh( const std::string &rMaterialName )
{
if(m_pModel->m_pCurrentMesh == 0)
{
// No mesh data yet
return true;
}
bool newMat = false;
int matIdx = getMaterialIndex( rMaterialName );
int curMatIdx = m_pModel->m_pCurrentMesh->m_uiMaterialIndex;

View File

@ -0,0 +1,22 @@
# Blender3D MTL File:
# Material Count: 2
newmtl Orange
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.739482 0.420173 0.148173
Ks 0.500000 0.500000 0.500000
Ni 1.000000
d 1.000000
illum 2
newmtl Silver
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.480000 0.480000 0.480000
Ks 0.500000 0.500000 0.500000
Ni 1.000000
d 1.000000
illum 2

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
Obj exported from Blender
http://toychest.in.tum.de/wiki/projects:kuka_lwr
License: Creative-Commons-by-Attribution-3.0