Fix null check in Q3BSPFileImporter
Reverse the null condition, preventing invalid texture stream dereferencing. Fixes #380.pull/381/head
parent
49c9786b0a
commit
485aa8b39d
|
@ -641,17 +641,17 @@ bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *pMode
|
||||||
bool res = true;
|
bool res = true;
|
||||||
sQ3BSPTexture *pTexture = pModel->m_Textures[ textureId ];
|
sQ3BSPTexture *pTexture = pModel->m_Textures[ textureId ];
|
||||||
if ( !pTexture ) {
|
if ( !pTexture ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> supportedExtensions;
|
std::vector<std::string> supportedExtensions;
|
||||||
supportedExtensions.push_back( ".jpg" );
|
supportedExtensions.push_back( ".jpg" );
|
||||||
supportedExtensions.push_back( ".png" );
|
supportedExtensions.push_back( ".png" );
|
||||||
supportedExtensions.push_back( ".tga" );
|
supportedExtensions.push_back( ".tga" );
|
||||||
std::string textureName, ext;
|
std::string textureName, ext;
|
||||||
if ( expandFile( pArchive, pTexture->strName, supportedExtensions, textureName, ext ) ) {
|
if ( expandFile( pArchive, pTexture->strName, supportedExtensions, textureName, ext ) ) {
|
||||||
IOStream *pTextureStream = pArchive->Open( textureName.c_str() );
|
IOStream *pTextureStream = pArchive->Open( textureName.c_str() );
|
||||||
if ( !pTextureStream ) {
|
if ( pTextureStream ) {
|
||||||
size_t texSize = pTextureStream->FileSize();
|
size_t texSize = pTextureStream->FileSize();
|
||||||
aiTexture *pTexture = new aiTexture;
|
aiTexture *pTexture = new aiTexture;
|
||||||
pTexture->mHeight = 0;
|
pTexture->mHeight = 0;
|
||||||
|
|
Loading…
Reference in New Issue