mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-22 09:56:22 +01:00
engine: imagelib: fix possible NULL dereference
This commit is contained in:
parent
c896425ad9
commit
fed65dd497
@ -390,7 +390,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
if( Q_strrchr( name, '{' ))
|
||||
{
|
||||
// NOTE: decals with 'blue base' can be interpret as colored decals
|
||||
if( !Image_CheckFlag( IL_LOAD_DECAL ) || ( pal[765] == 0 && pal[766] == 0 && pal[767] == 255 ))
|
||||
if( !Image_CheckFlag( IL_LOAD_DECAL ) || ( pal && pal[765] == 0 && pal[766] == 0 && pal[767] == 255 ))
|
||||
{
|
||||
SetBits( image.flags, IMAGE_ONEBIT_ALPHA );
|
||||
rendermode = LUMP_MASKED;
|
||||
@ -488,6 +488,8 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
}
|
||||
|
||||
// check for half-life water texture
|
||||
if( pal != NULL )
|
||||
{
|
||||
if( hl_texture && ( mip.name[0] == '!' || !Q_strnicmp( mip.name, "water", 5 )))
|
||||
{
|
||||
// grab the fog color
|
||||
@ -508,7 +510,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
// calc the decal reflectivity
|
||||
image.fogParams[3] = VectorAvg( image.fogParams );
|
||||
}
|
||||
else if( pal != NULL )
|
||||
else
|
||||
{
|
||||
// calc texture reflectivity
|
||||
for( i = 0; i < 256; i++ )
|
||||
@ -520,6 +522,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
|
||||
VectorDivide( reflectivity, 256, image.fogParams );
|
||||
}
|
||||
}
|
||||
|
||||
image.type = PF_INDEXED_32; // 32-bit palete
|
||||
image.depth = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user