From cf52029b51b994cf81346642e598cc50cda2f744 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 19 Mar 2012 11:12:40 -0700 Subject: [PATCH] Check if the game's ID is valid before accessing it to set the ntsc u/j register. Prevents discs without a real ID from crashing dolphin. --- Source/Core/Core/Src/Boot/Boot.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/Boot/Boot.cpp b/Source/Core/Core/Src/Boot/Boot.cpp index 3dcbf5730c..8ef6251339 100644 --- a/Source/Core/Core/Src/Boot/Boot.cpp +++ b/Source/Core/Core/Src/Boot/Boot.cpp @@ -227,7 +227,9 @@ bool CBoot::BootUp() // setup the map from ISOFile ID VolumeHandler::SetVolumeName(_StartupPara.m_strFilename); - VideoInterface::SetRegionReg((char)VolumeHandler::GetVolume()->GetUniqueID().at(3)); + std::string unique_id = VolumeHandler::GetVolume()->GetUniqueID(); + if (unique_id.size() >= 3) + VideoInterface::SetRegionReg(unique_id.at(3)); DVDInterface::SetDiscInside(VolumeHandler::IsValid());