Cheats: Fix error while exporting

This commit is contained in:
Stenzek 2025-01-04 12:50:29 +10:00
parent 548f1da5af
commit 78ccbc710c
No known key found for this signature in database
1 changed files with 1 additions and 1 deletions

View File

@ -1520,7 +1520,7 @@ bool Cheats::ExportCodesToFile(std::string path, const CodeInfoList& codes, Erro
for (const CodeInfo& code : codes)
{
const std::string code_body = FormatCodeForFile(code);
if (std::fwrite(code_body.data(), code_body.length(), 1, fp.get()) != 1 || std::fputc('\n', fp.get()) != 0)
if (std::fwrite(code_body.data(), code_body.length(), 1, fp.get()) != 1 || std::fputc('\n', fp.get()) == EOF)
{
Error::SetErrno(error, "fwrite() failed: ", errno);
FileSystem::DiscardAtomicRenamedFile(fp);