From 20d580881ae221aa92dbca5bbc2a0a3d918f123a Mon Sep 17 00:00:00 2001 From: Snowy Date: Sun, 26 Sep 2021 23:08:13 -0500 Subject: [PATCH] Handle missing background.bmp --- SDL/gui.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SDL/gui.c b/SDL/gui.c index 630e6e2..6bccd87 100644 --- a/SDL/gui.c +++ b/SDL/gui.c @@ -1160,6 +1160,12 @@ void run_gui(bool is_running) static SDL_Surface *converted_background = NULL; if (!converted_background) { SDL_Surface *background = SDL_LoadBMP(resource_path("background.bmp")); + + /* Create a blank background if background.bmp could not be loaded */ + if (!background) { + background = SDL_CreateRGBSurface(0, 160, 144, 8, 0, 0, 0, 0); + } + SDL_SetPaletteColors(background->format->palette, gui_palette, 0, 4); converted_background = SDL_ConvertSurface(background, pixel_format, 0); SDL_LockSurface(converted_background);