From 3d0ffabe75e813a02b0d9dd2f5eb92e45b17cc60 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sun, 24 Jul 2016 21:19:08 -0700 Subject: [PATCH] Minor tweaks Fix off by one and add a safety check for sav6 --- Saves/SAV6.cs | 3 ++- Subforms/Save Editors/Gen6/SAV_BoxLayout.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Saves/SAV6.cs b/Saves/SAV6.cs index 233062253..ea2d22dfa 100644 --- a/Saves/SAV6.cs +++ b/Saves/SAV6.cs @@ -646,7 +646,8 @@ public override int getBoxOffset(int box) } public override int getBoxWallpaper(int box) { - return 1 + Data[PCBackgrounds + box]; + int ofs = PCBackgrounds > 0 && PCBackgrounds < Data.Length ? PCBackgrounds : 0; + return Data[ofs + box]; } public override string getBoxName(int box) { diff --git a/Subforms/Save Editors/Gen6/SAV_BoxLayout.cs b/Subforms/Save Editors/Gen6/SAV_BoxLayout.cs index 391905559..671edb669 100644 --- a/Subforms/Save Editors/Gen6/SAV_BoxLayout.cs +++ b/Subforms/Save Editors/Gen6/SAV_BoxLayout.cs @@ -60,7 +60,7 @@ private void changeBoxBG(object sender, EventArgs e) if (!editing) SAV.Data[SAV.PCBackgrounds + LB_BoxSelect.SelectedIndex] = (byte)CB_BG.SelectedIndex; - PAN_BG.BackgroundImage = BoxWallpaper.getWallpaper(SAV, CB_BG.SelectedIndex + 1); + PAN_BG.BackgroundImage = BoxWallpaper.getWallpaper(SAV, CB_BG.SelectedIndex); } } } \ No newline at end of file