BUGFIX : Fix crash in material loader.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@535 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
kimmi 2010-02-02 19:54:37 +00:00
parent 5c0432057a
commit 21f948288c
2 changed files with 10 additions and 10 deletions

View File

@ -591,12 +591,12 @@ void ObjFileParser::createObject(const std::string &strObjectName)
m_pModel->m_pCurrent = new ObjFile::Object(); m_pModel->m_pCurrent = new ObjFile::Object();
m_pModel->m_pCurrent->m_strObjName = strObjectName; 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_pCurrentMesh = new ObjFile::Mesh();
m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh ); 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 = m_pModel->m_pCurrentMesh->m_uiMaterialIndex =
getMaterialIndex( m_pModel->m_pCurrentMaterial->MaterialName.data ); getMaterialIndex( m_pModel->m_pCurrentMaterial->MaterialName.data );

View File

@ -93,7 +93,7 @@ inline Char_T getNextWord( Char_T pBuffer, Char_T pEnd )
{ {
while ( !isEndOfBuffer( pBuffer, pEnd ) ) while ( !isEndOfBuffer( pBuffer, pEnd ) )
{ {
if ( !isSeparator( *pBuffer ) ) if ( !isSeparator( *pBuffer ) || isNewLine( *pBuffer ) )
break; break;
pBuffer++; pBuffer++;
} }
@ -126,7 +126,7 @@ inline Char_T getNextToken( Char_T pBuffer, Char_T pEnd )
template<class char_t> template<class char_t>
inline char_t skipLine( char_t it, char_t end, unsigned int &uiLine ) 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; ++it;
if ( it != end ) if ( it != end )
{ {