Skip to content

Commit

Permalink
clear the error buffer before showing another message
Browse files Browse the repository at this point in the history
  • Loading branch information
xan1242 committed Apr 7, 2022
1 parent 5aa2577 commit a2445ba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ void SaveGameForCurrentProfile()
FILE* fout = fopen(SaveFileName, "wb");
if (!fout)
{
errbuffer.str("");
errbuffer << "Can't open file " << SaveFileName << " for writing: " << strerror(errno);
err_text = errbuffer.str();
ImGui::OpenPopup(NUZLOCKE_HEADER_ERROR);
Expand Down Expand Up @@ -709,6 +710,7 @@ void LoadGameForCurrentProfile()
FILE* fin = fopen(SaveFileName, "rb");
if (!fin)
{
errbuffer.str("");
errbuffer << "Can't open file " << SaveFileName << " for reading: " << strerror(errno);
err_text = errbuffer.str();
ImGui::OpenPopup(NUZLOCKE_HEADER_ERROR);
Expand All @@ -720,6 +722,7 @@ void LoadGameForCurrentProfile()
fread(&LoadGame, sizeof(NuzlockeSave), 1, fin);
if (LoadGame.Magic != 0x4C5A554E)
{
errbuffer.str("");
errbuffer << "Wrong file magic! Expected: 0x4C5A554E Read: 0x" << std::uppercase << std::hex << LoadGame.Magic << std::endl;
err_text = errbuffer.str();
ImGui::OpenPopup(NUZLOCKE_HEADER_ERROR);
Expand Down

0 comments on commit a2445ba

Please sign in to comment.