1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 12:42:11 +00:00

Extra check in case of invalid index values.

This commit is contained in:
Jan Borsodi 2010-09-14 15:30:47 +02:00
parent b1451c4349
commit 670174004a

View File

@ -58,6 +58,7 @@ RaceDialog::RaceDialog(MWWorld::Environment& environment)
raceList->setScrollVisible(true); raceList->setScrollVisible(true);
raceList->eventListSelectAccept = MyGUI::newDelegate(this, &RaceDialog::onSelectRace); raceList->eventListSelectAccept = MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
raceList->eventListMouseItemActivate = MyGUI::newDelegate(this, &RaceDialog::onSelectRace); raceList->eventListMouseItemActivate = MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
raceList->eventListChangePosition = MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
getWidget(skillList, "SkillList"); getWidget(skillList, "SkillList");
getWidget(spellPowerList, "SpellPowerList"); getWidget(spellPowerList, "SpellPowerList");
@ -134,6 +135,9 @@ void RaceDialog::onSelectNextHair(MyGUI::Widget*)
void RaceDialog::onSelectRace(MyGUI::List* _sender, size_t _index) void RaceDialog::onSelectRace(MyGUI::List* _sender, size_t _index)
{ {
if (_index == MyGUI::ITEM_NONE)
return;
const std::string race = raceList->getItem(_index); const std::string race = raceList->getItem(_index);
if (boost::iequals(currentRace, race)) if (boost::iequals(currentRace, race))
return; return;