From da893a5b86e4d3eb718930b97bdee9326c1e1df3 Mon Sep 17 00:00:00 2001 From: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com> Date: Sun, 25 Sep 2022 18:19:53 +0200 Subject: [PATCH] Fix save corruption on switch (#1585) --- soh/soh/SaveManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index 27360303a..e1d3636f4 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -523,9 +523,9 @@ void SaveManager::SaveFile(int fileNum) { } #ifdef __SWITCH__ - const char* json_string = baseBlock.dump(4).c_str(); FILE* w = fopen(GetFileName(fileNum).c_str(), "w"); - fwrite(json_string, sizeof(char), strlen(json_string), w); + std::string json_string = baseBlock.dump(4); + fwrite(json_string.c_str(), sizeof(char), json_string.length(), w); fclose(w); #else