Instead of crashing log a warning when trying to skip more codes than are available

This commit is contained in:
Peter Tissen 2015-01-10 22:56:27 +01:00
parent 1fa67104ce
commit 101287c8c2

View File

@ -206,7 +206,13 @@ std::vector<int> CWCheatEngine::GetNextCode() { // Feeds a size-2 vector of ints
void CWCheatEngine::SkipCodes(int count) {
for (int i = 0; i < count; i ++) {
if (GetNextCode()[0] == 0) {
auto code = GetNextCode();
if (code.empty())
{
WARN_LOG(COMMON, "CWCHEAT: Tried to skip more codes than there are, the cheat is most likely wrong");
break;
}
if (code[0] == 0) {
break;
}
}