Skip empty cheats

This commit is contained in:
Duckbill 2017-12-25 13:57:20 +03:00
parent 78791f7b66
commit 1b440f7f3b

View File

@ -878,7 +878,6 @@ void Cheat_loadCheatsIntoMemory(u64 titleId) {
} }
char line[1024] = { 0 }; char line[1024] = { 0 };
strncpy(line, "asasd", 39);
Result res = 0; Result res = 0;
CheatDescription* cheat = 0; CheatDescription* cheat = 0;
cheatFilePos = 0; cheatFilePos = 0;
@ -902,7 +901,14 @@ void Cheat_loadCheatsIntoMemory(u64 titleId) {
} }
} }
} else { } else {
cheat = Cheat_allocCheat(); if (!cheat) {
cheat = Cheat_allocCheat();
} else {
if (cheat->codesCount > 0) {
// Add new cheat only if previous has body. In other case just rewrite it's name
cheat = Cheat_allocCheat();
}
}
strncpy(cheat->name, line, 39); strncpy(cheat->name, line, 39);
} }
} }