win32: only enable cheat if it was valid

This commit is contained in:
OV2 2018-07-03 20:42:11 +02:00
parent 42a2bc6e72
commit b65b07112c
1 changed files with 3 additions and 2 deletions

View File

@ -10351,8 +10351,9 @@ INT_PTR CALLBACK DlgCheatSearchAdd(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
code_string += code;
}
S9xAddCheatGroup(new_cheat->name, code_string.c_str());
S9xEnableCheatGroup(Cheat.g.size() - 1);
int index = S9xAddCheatGroup(new_cheat->name, code_string.c_str());
if(index >= 0)
S9xEnableCheatGroup(index);
ret=0;
}