BUGFIX : Fix crash in material loader.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@535 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
5c0432057a
commit
21f948288c
|
@ -484,14 +484,14 @@ int ObjFileParser::getMaterialIndex( const std::string &strMaterialName )
|
|||
int mat_index = -1;
|
||||
if ( strMaterialName.empty() )
|
||||
return mat_index;
|
||||
for (size_t index = 0; index < m_pModel->m_MaterialLib.size(); ++index)
|
||||
for (size_t index = 0; index < m_pModel->m_MaterialLib.size(); ++index)
|
||||
{
|
||||
if ( strMaterialName == m_pModel->m_MaterialLib[ index ])
|
||||
{
|
||||
if ( strMaterialName == m_pModel->m_MaterialLib[ index ])
|
||||
{
|
||||
mat_index = (int)index;
|
||||
break;
|
||||
}
|
||||
mat_index = (int)index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return mat_index;
|
||||
}
|
||||
|
||||
|
@ -591,12 +591,12 @@ void ObjFileParser::createObject(const std::string &strObjectName)
|
|||
|
||||
m_pModel->m_pCurrent = new ObjFile::Object();
|
||||
m_pModel->m_pCurrent->m_strObjName = strObjectName;
|
||||
m_pModel->m_Objects.push_back(m_pModel->m_pCurrent);
|
||||
m_pModel->m_Objects.push_back( m_pModel->m_pCurrent );
|
||||
|
||||
m_pModel->m_pCurrentMesh = new ObjFile::Mesh();
|
||||
m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh );
|
||||
|
||||
if(m_pModel->m_pCurrentMaterial)
|
||||
if( m_pModel->m_pCurrentMaterial )
|
||||
{
|
||||
m_pModel->m_pCurrentMesh->m_uiMaterialIndex =
|
||||
getMaterialIndex( m_pModel->m_pCurrentMaterial->MaterialName.data );
|
||||
|
|
|
@ -93,7 +93,7 @@ inline Char_T getNextWord( Char_T pBuffer, Char_T pEnd )
|
|||
{
|
||||
while ( !isEndOfBuffer( pBuffer, pEnd ) )
|
||||
{
|
||||
if ( !isSeparator( *pBuffer ) )
|
||||
if ( !isSeparator( *pBuffer ) || isNewLine( *pBuffer ) )
|
||||
break;
|
||||
pBuffer++;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ inline Char_T getNextToken( Char_T pBuffer, Char_T pEnd )
|
|||
template<class char_t>
|
||||
inline char_t skipLine( char_t it, char_t end, unsigned int &uiLine )
|
||||
{
|
||||
while ( !isEndOfBuffer( it, end ) && *it != '\n' )
|
||||
while ( !isEndOfBuffer( it, end ) && !isNewLine( *it ) )
|
||||
++it;
|
||||
if ( it != end )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue