From 85dc376454224dae3669b12b099459fbbeefe0de Mon Sep 17 00:00:00 2001 From: James Pelster Date: Wed, 15 Mar 2017 19:46:35 -0700 Subject: [PATCH] Fix NPE loading Personal Stats for Pokemon with no sprite resource This has been a really long-standing bug, hopefully it's fixed for good! --- pk3DS/Misc/Patch.cs | 2 +- pk3DS/Subforms/Gen6/PersonalEditor6.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pk3DS/Misc/Patch.cs b/pk3DS/Misc/Patch.cs index d8264d0..7bb347f 100644 --- a/pk3DS/Misc/Patch.cs +++ b/pk3DS/Misc/Patch.cs @@ -109,7 +109,7 @@ private void B_PatchCIA_Click(object sender, EventArgs e) catch (Exception ex) { Util.Error("Could not create patch:", ex.ToString()); - Directory.Delete(patchFolder, true); + if (Directory.Exists(patchFolder)) Directory.Delete(patchFolder, true); } } diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.cs index 36a5d77..ae478ae 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.cs @@ -257,6 +257,7 @@ private void readEntry() int[] specForm = { s, f }; string filename = "_" + specForm[0] + (CB_Species.SelectedIndex > 721 ? "_" + (specForm[1] + 1) : ""); Bitmap rawImg = (Bitmap)Resources.ResourceManager.GetObject(filename); + if (rawImg == null) rawImg = Resources.unknown; Bitmap bigImg = new Bitmap(rawImg.Width * 2, rawImg.Height * 2); for (int x = 0; x < rawImg.Width; x++) {