diff --git a/PKHeX.Core/Saves/SAV4.cs b/PKHeX.Core/Saves/SAV4.cs index 07510afed..9b56ea99c 100644 --- a/PKHeX.Core/Saves/SAV4.cs +++ b/PKHeX.Core/Saves/SAV4.cs @@ -579,7 +579,7 @@ public int Y // Storage public override int CurrentBox { - get => Data[Version == GameVersion.HGSS ? GetBoxOffset(BoxCount) : Box - 4]; + get => (sbyte)Data[Version == GameVersion.HGSS ? GetBoxOffset(BoxCount) : Box - 4]; set => Data[Version == GameVersion.HGSS ? GetBoxOffset(BoxCount) : Box - 4] = (byte)value; } diff --git a/PKHeX.WinForms/Controls/SAV Editor/BoxEditor.cs b/PKHeX.WinForms/Controls/SAV Editor/BoxEditor.cs index b57aecd65..35eb2a8fb 100644 --- a/PKHeX.WinForms/Controls/SAV Editor/BoxEditor.cs +++ b/PKHeX.WinForms/Controls/SAV Editor/BoxEditor.cs @@ -257,7 +257,10 @@ private void GetBox(object sender, EventArgs e) public void InitializeFromSAV(SaveFile sav) { Editor = new BoxEdit(sav); - Editor.LoadBox(sav.CurrentBox); + int box = sav.CurrentBox; + if ((uint)box >= sav.BoxCount) + box = 0; + Editor.LoadBox(box); ResetBoxNames(); // Display the Box Names } }