From d42123928a28d721e12e478dc537ef4fbb72661c Mon Sep 17 00:00:00 2001 From: zysftd Date: Mon, 13 Jul 2026 10:11:06 +0800 Subject: [PATCH] fix: delete corrupted autosave on load failure to prevent crash loops (AI-generated) --- external/vcpkg | 2 +- source/Gui/MainLoopController.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/external/vcpkg b/external/vcpkg index af752f21c..f87344cac 160000 --- a/external/vcpkg +++ b/external/vcpkg @@ -1 +1 @@ -Subproject commit af752f21c9d79ba3df9cb0250ce2233933f58486 +Subproject commit f87344cac03158cbf1467264565f1fd36b382a24 diff --git a/source/Gui/MainLoopController.cpp b/source/Gui/MainLoopController.cpp index 36c276db9..4ab0b3c3b 100644 --- a/source/Gui/MainLoopController.cpp +++ b/source/Gui/MainLoopController.cpp @@ -2,6 +2,8 @@ #include +#include + #include #include @@ -165,6 +167,11 @@ void MainLoopController::processLoadingScreen() if (requestedSimState.value() == PersisterRequestState::Error) { GenericMessageDialog::get().information("Error", "The default simulation file could not be read.\nAn empty simulation will be created."); + try { + std::filesystem::remove_all(Const::AutosavePath); + } catch (...) { + } + DeserializedSimulation deserializedSim; deserializedSim.auxiliaryData.worldSize.x = 1000; deserializedSim.auxiliaryData.worldSize.y = 500;