summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeGC.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-07-16 14:52:17 +0200
committerJosJuice <josjuice@gmail.com>2017-07-16 14:52:17 +0200
commitbe8e93f472ba8630622dd71a5b50a065ca942977 (patch)
tree28b291563b6e87b724f4ed1bec6fd832015b8381 /Source/Core/DiscIO/VolumeGC.cpp
parentdb1c534b3ecddf23ad57b03c80b74de55466b062 (diff)
Ensure that Volume::GetRegion doesn't return invalid enum values
Diffstat (limited to 'Source/Core/DiscIO/VolumeGC.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeGC.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp
index dd13ecdcd0..46ac57278c 100644
--- a/Source/Core/DiscIO/VolumeGC.cpp
+++ b/Source/Core/DiscIO/VolumeGC.cpp
@@ -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