From 2cd9632c4aaaac36a451d6bbebef6312701aae30 Mon Sep 17 00:00:00 2001 From: santacrab2 <79347566+santacrab2@users.noreply.github.com> Date: Mon, 28 Oct 2024 19:21:44 -0400 Subject: [PATCH] MailBox fix (#4377) * Catches Out Of Bounds error on ListBox SelectedIndex for when the B_PartyDown_Click event is triggered and the current Selection is in LB_PCBOX. --- PKHeX.WinForms/Subforms/Save Editors/SAV_MailBox.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PKHeX.WinForms/Subforms/Save Editors/SAV_MailBox.cs b/PKHeX.WinForms/Subforms/Save Editors/SAV_MailBox.cs index 9d9f2a374..bf4c03cf3 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/SAV_MailBox.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/SAV_MailBox.cs @@ -586,6 +586,8 @@ private void NUD_MailIDn_ValueChanged(object sender, EventArgs e) private void SwapSlots(ListBox lb, bool down) { + if (lb.SelectedIndex == -1) + return; int index = lb.SelectedIndex; var otherIndex = index + (down ? 1 : -1); if ((uint)otherIndex >= lb.Items.Count)