From 96188a3e8d63c9820169ef095cd3c488c6038469 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sun, 18 Sep 2016 19:43:49 -0700 Subject: [PATCH] Tweak itemname set to avoid exception Set the value to (None) & 0 while we're at it, instead of leaving the row uninitialized. Thanks Delta Blast Burn! --- PKHeX/Subforms/Save Editors/SAV_Inventory.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PKHeX/Subforms/Save Editors/SAV_Inventory.cs b/PKHeX/Subforms/Save Editors/SAV_Inventory.cs index 49fadc449..73d301e03 100644 --- a/PKHeX/Subforms/Save Editors/SAV_Inventory.cs +++ b/PKHeX/Subforms/Save Editors/SAV_Inventory.cs @@ -130,12 +130,15 @@ private void spillBag(DataGridView dgv, int bag) for (int i = 0; i < pouch.Items.Length; i++) { int itemvalue = pouch.Items[i].Index; - try { itemname = itemlist[itemvalue]; } - catch + if (itemvalue >= itemlist.Length) { Util.Error("Unknown item detected.", "Item ID: " + itemvalue, "Item is after: " + itemname); + dgv.Rows[i].Cells[0].Value = itemarr[0]; + dgv.Rows[i].Cells[1].Value = 0; continue; } + itemname = itemlist[itemvalue]; + int itemarrayval = Array.IndexOf(itemarr, itemname); if (itemarrayval == -1) {