Special case for final line read (#1473)

Fixes cheat files without a trailing newline
This commit is contained in:
Chris Feger 2020-07-29 23:22:57 -04:00 committed by GitHub
parent b15becb37a
commit ebeef7ab7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

4
sysmodules/rosalina/source/menus/cheats.c Normal file → Executable file
View File

@ -1801,7 +1801,9 @@ static void Cheat_LoadCheatsIntoMemory(u64 titleId)
do
{
res = Cheat_ReadLine(&file, line, 1024);
if (R_SUCCEEDED(res))
// -1 is special; it can't be a normal result because of how results are constructed
// So let's just use it as a signal that this is the final line of a file
if (R_SUCCEEDED(res) || res == -1)
{
char* strippedLine = stripWhitespace(line);
s32 lineLen = strnlen(strippedLine, 1023);