diff --git a/PKHeX.Core/Saves/Substructures/Gen3/SecretBaseManager3.cs b/PKHeX.Core/Saves/Substructures/Gen3/SecretBaseManager3.cs index c51ebc842..7afaaa779 100644 --- a/PKHeX.Core/Saves/Substructures/Gen3/SecretBaseManager3.cs +++ b/PKHeX.Core/Saves/Substructures/Gen3/SecretBaseManager3.cs @@ -44,15 +44,15 @@ private Memory GetBase(int index) private void WriteTo(Span data) { - // Initialize: Wipe trainer name of each slot - for (int i = 0; i < BaseCount; i++) - data.Slice((i * SecretBase3.SIZE) + 2, 7).Fill(StringConverter3.TerminatorByte); - var tmp = Bases.ToList(); for (int i = 0; i < BaseCount; i++) { if (!Occupied[i]) + { + // Initialize: Wipe trainer name of each slot + data.Slice((i * SecretBase3.SIZE) + 2, 7).Fill(StringConverter3.TerminatorByte); continue; + } var tmpbase = tmp[0]; tmpbase.Data.CopyTo(data[(i * SecretBase3.SIZE)..]); tmp.RemoveAt(0);