Failure to load PCX/BMP/TGA should not result in a fatal error. Check the existence of these files first, if the file does not exist, simply return. This way we'll still blow up on malformed images, which is less annoying.

This commit is contained in:
jdolan 2013-06-29 11:05:49 -04:00
parent 217e3b51ad
commit 409f1fc026
2 changed files with 5 additions and 0 deletions

View file

@ -49,6 +49,7 @@ extern _QERFileSystemTable g_FileSystemTable;
void LoadJPG( const char *filename, unsigned char **pic, int *width, int *height );
#define Error g_FuncTable.m_pfnError
#define vfsGetFileCount g_FileSystemTable.m_pfnGetFileCount
#define vfsLoadFile g_FileSystemTable.m_pfnLoadFile
#define vfsFreeFile g_FileSystemTable.m_pfnFreeFile

View file

@ -743,6 +743,10 @@ void LoadImage( const char *name, byte ** pic, int *width, int *height ){
return;
}
if ( vfsGetFileCount( name, 0 ) == 0 ) {
return;
}
if ( !g_ascii_strcasecmp( name + len - 4, ".tga" ) ) {
LoadTGA( name, pic, width, height );
}