mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 04:38:49 +00:00
Ensure that Volume::GetRegion doesn't return invalid enum values
This commit is contained in:
parent
db1c534b3e
commit
be8e93f472
2 changed files with 8 additions and 2 deletions
|
@ -61,7 +61,10 @@ std::string VolumeGC::GetGameID(const Partition& partition) const
|
|||
Region VolumeGC::GetRegion() const
|
||||
{
|
||||
const std::optional<u32> region_code = ReadSwapped<u32>(0x458, PARTITION_NONE);
|
||||
return region_code ? static_cast<Region>(*region_code) : Region::UNKNOWN_REGION;
|
||||
if (!region_code)
|
||||
return Region::UNKNOWN_REGION;
|
||||
const Region region = static_cast<Region>(*region_code);
|
||||
return region <= Region::PAL ? region : Region::UNKNOWN_REGION;
|
||||
}
|
||||
|
||||
Country VolumeGC::GetCountry(const Partition& partition) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue