From f513db405e50e54a3a910a480afca74053438fee Mon Sep 17 00:00:00 2001 From: Bobby Smith <33353403+bslenul@users.noreply.github.com> Date: Wed, 17 May 2023 15:09:49 +0200 Subject: [PATCH] Prevent crash if BIOS is missing --- libretro.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libretro.cpp b/libretro.cpp index ee68c4a..2286b84 100644 --- a/libretro.cpp +++ b/libretro.cpp @@ -1139,7 +1139,10 @@ static int HuCLoadCD(const char *bios_path) MDFNFILE *fp = file_open(bios_path); if(!fp) + { + MDFN_DispMessage("Firmware not found: '%s'", bios_path); return(0); + } memset(ROMSpace, 0xFF, 262144); @@ -2419,12 +2422,13 @@ void retro_get_system_av_info(struct retro_system_av_info *info) void retro_deinit(void) { - if (surf->pixels) - free(surf->pixels); - surf->pixels = NULL; - if (surf) + { + if (surf->pixels) + free(surf->pixels); + surf->pixels = NULL; free(surf); + } surf = NULL; if (log_cb)