mirror of https://github.com/stella-emu/stella.git
Fix crash when combomap isn't defined in config file.
This commit is contained in:
parent
b276a1e6a7
commit
b51fd4d07a
|
@ -1093,29 +1093,36 @@ void EventHandler::setComboMap()
|
||||||
{
|
{
|
||||||
// Get combo count, which should be the first int in the list
|
// Get combo count, which should be the first int in the list
|
||||||
// If it isn't, then we treat the entire list as invalid
|
// If it isn't, then we treat the entire list as invalid
|
||||||
string key;
|
try
|
||||||
buf >> key;
|
|
||||||
if(stoi(key) == COMBO_SIZE)
|
|
||||||
{
|
{
|
||||||
// Fill the combomap table with events for as long as they exist
|
string key;
|
||||||
int combocount = 0;
|
buf >> key;
|
||||||
while(buf >> key && combocount < COMBO_SIZE)
|
if(stoi(key) == COMBO_SIZE)
|
||||||
{
|
{
|
||||||
// Each event in a comboevent is separated by a comma
|
// Fill the combomap table with events for as long as they exist
|
||||||
replace(key.begin(), key.end(), ',', ' ');
|
int combocount = 0;
|
||||||
istringstream buf2(key);
|
while(buf >> key && combocount < COMBO_SIZE)
|
||||||
|
|
||||||
int eventcount = 0;
|
|
||||||
while(buf2 >> key && eventcount < EVENTS_PER_COMBO)
|
|
||||||
{
|
{
|
||||||
myComboTable[combocount][eventcount] = Event::Type(stoi(key));
|
// Each event in a comboevent is separated by a comma
|
||||||
++eventcount;
|
replace(key.begin(), key.end(), ',', ' ');
|
||||||
|
istringstream buf2(key);
|
||||||
|
|
||||||
|
int eventcount = 0;
|
||||||
|
while(buf2 >> key && eventcount < EVENTS_PER_COMBO)
|
||||||
|
{
|
||||||
|
myComboTable[combocount][eventcount] = Event::Type(stoi(key));
|
||||||
|
++eventcount;
|
||||||
|
}
|
||||||
|
++combocount;
|
||||||
}
|
}
|
||||||
++combocount;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
ERASE_ALL();
|
||||||
}
|
}
|
||||||
else
|
catch(...)
|
||||||
|
{
|
||||||
ERASE_ALL();
|
ERASE_ALL();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
saveComboMapping();
|
saveComboMapping();
|
||||||
|
|
Loading…
Reference in New Issue