Cheats: Fix error while exporting

This commit is contained in:
Stenzek committed 2025-01-04 12:52:26 +10:00
1 parent 548f1da5af
commit 78ccbc710c
1 file changed
+1 -1
+1 -1
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);