mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-17 22:25:37 +00:00
HostInterface: Fix possible crash in BIOS loading
This commit is contained in:
parent
d7f8884291
commit
5aba89091e
|
@ -295,12 +295,15 @@ std::optional<std::vector<u8>> HostInterface::GetBIOSImage(ConsoleRegion region)
|
|||
{ \
|
||||
std::string try_filename = filename; \
|
||||
std::optional<BIOS::Image> found_image = BIOS::LoadImageFromFile(try_filename); \
|
||||
BIOS::Hash found_hash = BIOS::GetHash(*found_image); \
|
||||
Log_DevPrintf("Hash for BIOS '%s': %s", try_filename.c_str(), found_hash.ToString().c_str()); \
|
||||
if (BIOS::IsValidHashForRegion(region, found_hash)) \
|
||||
if (found_image) \
|
||||
{ \
|
||||
Log_InfoPrintf("Using BIOS from '%s'", try_filename.c_str()); \
|
||||
return found_image; \
|
||||
BIOS::Hash found_hash = BIOS::GetHash(*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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue