diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index 7878e86642..22086bdf5c 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -1155,15 +1155,16 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v } } - auto delete_save = [&]() + const auto delete_save = [&]() { - strcpy_trunc(doneGet->dirName, save_entries[selected].dirName); + const SaveDataEntry& entry = ::at32(save_entries, selected); + strcpy_trunc(doneGet->dirName, entry.dirName); doneGet->hddFreeSizeKB = 40 * 1024 * 1024 - 256; // Read explanation in cellHddGameCheck doneGet->excResult = CELL_OK; std::memset(doneGet->reserved, 0, sizeof(doneGet->reserved)); - const std::string old_path = base_dir + ".backup_" + save_entries[selected].escaped + "/"; - const std::string del_path = base_dir + save_entries[selected].escaped + "/"; + const std::string old_path = base_dir + ".backup_" + entry.escaped + "/"; + const std::string del_path = base_dir + entry.escaped + "/"; const fs::dir _dir(del_path); u64 size_bytes = 0; @@ -1456,7 +1457,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v } else { - fmt::throw_exception("Invalid savedata selected"); + fmt::throw_exception("Invalid savedata selected (selected=%d)", selected); } } }