From f5344452cf546fc5ffe8b8344e28c269b2286c0d Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 9 Feb 2022 10:36:46 -0800 Subject: [PATCH] Fix last funfest mission record r/w Closes #3423 --- PKHeX.Core/Saves/Substructures/Gen5/FestaBlock5.cs | 4 ++-- PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PKHeX.Core/Saves/Substructures/Gen5/FestaBlock5.cs b/PKHeX.Core/Saves/Substructures/Gen5/FestaBlock5.cs index ade4588b7..4e99d2392 100644 --- a/PKHeX.Core/Saves/Substructures/Gen5/FestaBlock5.cs +++ b/PKHeX.Core/Saves/Substructures/Gen5/FestaBlock5.cs @@ -81,7 +81,7 @@ public bool IsFunfestMissionsUnlocked public bool IsFunfestMissionUnlocked(int mission) { - if ((uint) mission >= MaxMissionIndex) + if ((uint) mission > MaxMissionIndex) throw new ArgumentOutOfRangeException(nameof(mission)); if (mission == 0) @@ -98,7 +98,7 @@ public bool IsFunfestMissionUnlocked(int mission) public void UnlockFunfestMission(int mission) { - if ((uint)mission >= MaxMissionIndex) + if ((uint)mission > MaxMissionIndex) throw new ArgumentOutOfRangeException(nameof(mission)); IsFunfestMissionsUnlocked = true; diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.cs index eade8ccbf..b5c0100ae 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.cs @@ -387,7 +387,7 @@ private void LoadFestaMissionRecord() { FestaBlock5 block = ((SAV5B2W2) SAV).Festa; int mission = LB_FunfestMissions.SelectedIndex; - if ((uint) mission >= FestaBlock5.MaxMissionIndex) + if ((uint) mission > FestaBlock5.MaxMissionIndex) return; bool unlocked = block.IsFunfestMissionUnlocked(mission); L_FMUnlocked.Visible = unlocked; @@ -407,7 +407,7 @@ private void ChangeFestaMissionValue(object sender, EventArgs e) FestaBlock5 block = ((SAV5B2W2)SAV).Festa; int mission = LB_FunfestMissions.SelectedIndex; - if ((uint)mission >= FestaBlock5.MaxMissionIndex) + if ((uint)mission > FestaBlock5.MaxMissionIndex) return; var score = new Funfest5Score((int)NUD_FMBestTotal.Value, (int)NUD_FMBestScore.Value, CB_FMLevel.SelectedIndex & 3, CHK_FMNew.Checked);