check error on header read

This commit is contained in:
tTh 2024-07-16 18:58:11 +02:00
parent d9d2db45b0
commit 449705c0ee
1 changed files with 6 additions and 2 deletions

View File

@ -497,8 +497,7 @@ return OLL_KORRECT;
* que les images RGB. il manque le GRIS !!!
* ! il manque aussi la decompression !
*/
Image_Desc *
Image_TGA_alloc_load(char *nom)
Image_Desc * Image_TGA_alloc_load(char *nom)
{
Tga_file_header head;
FILE *fp;
@ -516,6 +515,11 @@ if ( (fp=fopen(nom, "rb")) == NULL )
memset(&head, 0, sizeof(Tga_file_header));
foo = Image_TGA_read_header(fp, &head);
if (foo) {
fprintf(stderr, "%s: read error %d on header\n", __func__, foo);
fclose(fp);
return NULL;
}
#if DEBUG_LEVEL > 1
printf("TGA ALLOC LOAD: read header -> %d\n", foo);