HostInterface: Fix possible crash in BIOS loading

This commit is contained in:
Connor McLaughlin 2020-02-14 22:45:54 +09:00
parent d7f8884291
commit 5aba89091e

View file

@ -295,12 +295,15 @@ std::optional<std::vector<u8>> HostInterface::GetBIOSImage(ConsoleRegion region)
{ \ { \
std::string try_filename = filename; \ std::string try_filename = filename; \
std::optional<BIOS::Image> found_image = BIOS::LoadImageFromFile(try_filename); \ std::optional<BIOS::Image> found_image = BIOS::LoadImageFromFile(try_filename); \
BIOS::Hash found_hash = BIOS::GetHash(*found_image); \ if (found_image) \
Log_DevPrintf("Hash for BIOS '%s': %s", try_filename.c_str(), found_hash.ToString().c_str()); \
if (BIOS::IsValidHashForRegion(region, found_hash)) \
{ \ { \
Log_InfoPrintf("Using BIOS from '%s'", try_filename.c_str()); \ BIOS::Hash found_hash = BIOS::GetHash(*found_image); \
return found_image; \ Log_DevPrintf("Hash for BIOS '%s': %s", try_filename.c_str(), found_hash.ToString().c_str()); \
if (BIOS::IsValidHashForRegion(region, found_hash)) \
{ \
Log_InfoPrintf("Using BIOS from '%s'", try_filename.c_str()); \
return found_image; \
} \
} \ } \
} while (0) } while (0)