From d6f8a79f1b22353d51fc8f7dc6483fd0cebb8e8c Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Tue, 15 Nov 2016 17:31:26 -0600 Subject: [PATCH] Fixed crash when opening SAV_BoxLayout with Gen 4 save Should fix issue #415 --- .../Save Editors/Gen6/SAV_BoxLayout.cs | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/PKHeX/Subforms/Save Editors/Gen6/SAV_BoxLayout.cs b/PKHeX/Subforms/Save Editors/Gen6/SAV_BoxLayout.cs index fd51de3a5..8e5635215 100644 --- a/PKHeX/Subforms/Save Editors/Gen6/SAV_BoxLayout.cs +++ b/PKHeX/Subforms/Save Editors/Gen6/SAV_BoxLayout.cs @@ -15,11 +15,21 @@ public SAV_BoxLayout(int box) // Repopulate Wallpaper names CB_BG.Items.Clear(); - if (SAV.Generation == 6) - CB_BG.Items.AddRange(Main.GameStrings.wallpapernames); - else if (SAV.Generation == 7) - CB_BG.Items.AddRange(Main.GameStrings.wallpapernames.Take(16).ToArray()); - + switch (SAV.Generation) + { + case 4: + case 5: + case 6: + CB_BG.Items.AddRange(Main.GameStrings.wallpapernames); + break; + case 7: + CB_BG.Items.AddRange(Main.GameStrings.wallpapernames.Take(16).ToArray()); + break; + default: + Util.Error("Box layout is not supported for this game."); + return; + } + // Go LB_BoxSelect.Items.Clear(); for (int i = 0; i < SAV.BoxCount; i++)