Handle case that ResizeSTB() failed.

This unlikely, however the compiler printed a warning that `image` may
be used uninitialized.
This commit is contained in:
Yamagi 2023-01-21 16:43:27 +01:00
parent e17d4f5dc0
commit 6566a2ae7d

View file

@ -376,8 +376,7 @@ R_LoadPic (char *name, byte *pic, int width, int realwidth, int height, int real
// resize image
pic32 = malloc(uploadwidth * uploadheight * 4);
if (ResizeSTB(pic, width, height,
pic32, uploadwidth, uploadheight))
if (ResizeSTB(pic, width, height, pic32, uploadwidth, uploadheight))
{
R_Convert32To8bit(pic32, pic8, uploadwidth * uploadheight, type != it_wall);
image = R_LoadPic8(name, pic8,
@ -385,6 +384,14 @@ R_LoadPic (char *name, byte *pic, int width, int realwidth, int height, int real
uploadheight, realheight,
uploadwidth * uploadheight, type);
}
else
{
R_Convert32To8bit(pic, pic8, data_size, type != it_wall);
image = R_LoadPic8 (name, pic8,
width, realwidth,
height, realheight,
data_size, type);
}
free(pic32);
}
else