Fix "bad wxCheckListBox index" warning when trying to create AR Code

Fixes issue
[7060](https://code.google.com/p/dolphin-emu/issues/detail?id=7060)
This commit is contained in:
RolandMunsil 2014-08-05 20:07:23 -07:00
parent 6eb032a1ae
commit b0fc4b6ac9
1 changed files with 3 additions and 1 deletions

View File

@ -1371,9 +1371,11 @@ void CISOProperties::ActionReplayList_Save()
std::vector<std::string> lines; std::vector<std::string> lines;
std::vector<std::string> enabledLines; std::vector<std::string> enabledLines;
u32 index = 0; u32 index = 0;
u32 cheats_chkbox_count = Cheats->GetCount();
for (const ActionReplay::ARCode& code : arCodes) for (const ActionReplay::ARCode& code : arCodes)
{ {
if (Cheats->IsChecked(index)) //Check the index against the count because of the hacky way codes are added from the "Cheat Search" dialog
if ((index < cheats_chkbox_count) && Cheats->IsChecked(index))
enabledLines.push_back("$" + code.name); enabledLines.push_back("$" + code.name);
// Do not save default cheats. // Do not save default cheats.