SaveState: Reset VM when save state fails to load

This commit is contained in:
Benjamin Moir 2024-05-08 18:55:42 +10:00 committed by Connor McLaughlin
parent c6cd6b5eb3
commit 2fc4d02dd6
1 changed files with 3 additions and 0 deletions

View File

@ -1151,6 +1151,8 @@ bool SaveState_UnzipFromDisk(const std::string& filename, Error* error)
{ {
if (!error->IsValid()) if (!error->IsValid())
Error::SetString(error, "Save state corruption in internal structures."); Error::SetString(error, "Save state corruption in internal structures.");
VMManager::Reset();
return false; return false;
} }
@ -1166,6 +1168,7 @@ bool SaveState_UnzipFromDisk(const std::string& filename, Error* error)
if (!zff || !SavestateEntries[i]->FreezeIn(zff.get())) if (!zff || !SavestateEntries[i]->FreezeIn(zff.get()))
{ {
Error::SetString(error, fmt::format("Save state corruption in {}.", SavestateEntries[i]->GetFilename())); Error::SetString(error, fmt::format("Save state corruption in {}.", SavestateEntries[i]->GetFilename()));
VMManager::Reset();
return false; return false;
} }
} }