Fix Showdown Import with Null Forms

Fixes
https://projectpokemon.org/forums/forums/topic/40047-error-when-importing-pokemon-from-showdown/
This commit is contained in:
ReignOfComputer 2017-02-03 08:33:27 +08:00
parent 19dbae430c
commit 0be2bd4674

View file

@ -164,22 +164,29 @@ namespace PKHeX.Core
// Showdown Quirks
string form = Form;
switch (Species)
if (!string.IsNullOrWhiteSpace(form))
{
case 658: // Greninja
form = form.Replace("Ash", "");
form = form.Replace("Active", "");
break;
case 718: // Zygarde
form = form.Replace("-C", "");
form = form.Replace("50%", "");
form = form.Replace("100%", "Complete");
break;
case 774: // Minior
if (string.IsNullOrWhiteSpace(form) || form.StartsWith("M-"))
form = "Meteor";
form = form.Replace("C-", "");
break;
switch (Species)
{
case 658: // Greninja
form = form.Replace("Ash", "");
form = form.Replace("Active", "");
break;
case 718: // Zygarde
form = form.Replace("-C", "");
form = form.Replace("50%", "");
form = form.Replace("100%", "Complete");
break;
case 774: // Minior
if (form.StartsWith("M-"))
form = "Meteor";
form = form.Replace("C-", "");
break;
}
}
else if (Species == 774) // Minior
{
form = "Meteor";
}
// First Line: Name, Nickname, Gender, Item