prevent infinite loop in save migration (#396)

This commit is contained in:
Archez
2024-05-22 09:05:05 -05:00
committed by Garrett Cox
parent c366313994
commit 6ed017b362
+4 -2
View File
@@ -56,7 +56,9 @@ const std::unordered_map<uint32_t, std::function<void(nlohmann::json&)>> migrati
void SaveManager_MigrateSave(nlohmann::json& j) {
int version = j.value("version", 0);
while (version != CURRENT_SAVE_VERSION) {
// BENTODO: what should we do if the version number is greater?
while (version < CURRENT_SAVE_VERSION) {
if (migrations.contains(version)) {
auto migration = migrations.at(version);
migration(j);
@@ -241,4 +243,4 @@ extern "C" s32 SaveManager_SysFlashrom_ReadData(void* saveBuffer, u32 pageNum, u
return 0;
}
}
}
}