mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Fix UB where image loading fails in certain cases
This commit is contained in:
parent
4148234225
commit
b7da899674
1 changed files with 3 additions and 2 deletions
|
@ -21,7 +21,9 @@ extern "C"
|
||||||
|
|
||||||
static SDL_Surface* LoadImageRaw(const char* filename, unsigned char** data)
|
static SDL_Surface* LoadImageRaw(const char* filename, unsigned char** data)
|
||||||
{
|
{
|
||||||
//Temporary storage for the image that's loaded
|
*data = NULL;
|
||||||
|
|
||||||
|
// Temporary storage for the image that's loaded
|
||||||
SDL_Surface* loadedImage = NULL;
|
SDL_Surface* loadedImage = NULL;
|
||||||
|
|
||||||
unsigned int width, height;
|
unsigned int width, height;
|
||||||
|
@ -84,7 +86,6 @@ SDL_Surface* LoadImageSurface(const char* filename)
|
||||||
|
|
||||||
if (optimizedImage == NULL)
|
if (optimizedImage == NULL)
|
||||||
{
|
{
|
||||||
VVV_free(data);
|
|
||||||
vlog_error("Image not found: %s", filename);
|
vlog_error("Image not found: %s", filename);
|
||||||
SDL_assert(0 && "Image not found! See stderr.");
|
SDL_assert(0 && "Image not found! See stderr.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue