From 0be2bd467430f281be002591c49025a05e4bebe1 Mon Sep 17 00:00:00 2001 From: ReignOfComputer Date: Fri, 3 Feb 2017 08:33:27 +0800 Subject: [PATCH] Fix Showdown Import with Null Forms Fixes https://projectpokemon.org/forums/forums/topic/40047-error-when-importing-pokemon-from-showdown/ --- PKHeX/PKM/ShowdownSet.cs | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/PKHeX/PKM/ShowdownSet.cs b/PKHeX/PKM/ShowdownSet.cs index c20573418..b00c91352 100644 --- a/PKHeX/PKM/ShowdownSet.cs +++ b/PKHeX/PKM/ShowdownSet.cs @@ -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