Add missing sanity check in savedata_op

This commit is contained in:
Megamouse 2026-06-19 14:21:37 +02:00
parent 33123bff04
commit e32d19ffac

View File

@ -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);
}
}
}