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!
This commit is contained in:
James Pelster
2017-03-15 19:46:35 -07:00
parent d70d72d4c1
commit 85dc376454
2 changed files with 2 additions and 1 deletions

View File

@@ -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);
}
}

View File

@@ -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++)
{