fix stoi exception for Display_PPBlend

This commit is contained in:
thrust26 2020-02-06 20:12:37 +01:00
parent a937b8fea8
commit 7a7969ae8a
3 changed files with 20 additions and 3 deletions

View File

@ -583,7 +583,13 @@ void Console::togglePhosphor()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changePhosphor(int direction)
{
int blend = stoi(myProperties.get(PropType::Display_PPBlend));
int blend = 0;
try
{
blend = stoi(myProperties.get(PropType::Display_PPBlend));
}
catch (...) {}
if(direction == +1) // increase blend
{

View File

@ -91,7 +91,11 @@ void TIASurface::initialize(const Console& console,
}
else
{
p_blend = stoi(console.properties().get(PropType::Display_PPBlend));
try
{
p_blend = stoi(console.properties().get(PropType::Display_PPBlend));
}
catch (...) {}
enable = console.properties().get(PropType::Display_Phosphor) == "YES";
}
enablePhosphor(enable, p_blend);

View File

@ -460,7 +460,14 @@ void GameInfoDialog::loadEmulationProperties(const Properties& props)
myPPBlend->setEnabled(!alwaysPhosphor && usePhosphor);
const string& blend = props.get(PropType::Display_PPBlend);
myPPBlend->setValue(stoi(blend));
try
{
myPPBlend->setValue(stoi(blend));
}
catch (...)
{
myPPBlend->setValue(0);
}
// set vertical center
Int32 vcenter = stoi(props.get(PropType::Display_VCenter));