From 9df8e3c1fd83f7eee3672cf786791aa8db780f09 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 27 Nov 2015 17:39:38 -0800 Subject: [PATCH] Add sanity checks to wc6->pk6 conversion --- PKX/f1-Main.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PKX/f1-Main.cs b/PKX/f1-Main.cs index f1351806f..adf1f977c 100644 --- a/PKX/f1-Main.cs +++ b/PKX/f1-Main.cs @@ -598,10 +598,16 @@ namespace PKHeX if (ModifierKeys == Keys.Control) new SAV_Wondercard(input).Show(); else - populateFields(new WC6(input).convertToPK6(SAV).Data); + { + PK6 pk = new WC6(input).convertToPK6(SAV); + if (pk != null && pk.Species != 0) + populateFields(pk.Data); + } #endregion else - Util.Error("Attempted to load an unsupported file type/size.", "File Loaded:" + Environment.NewLine + path, "File Size:" + Environment.NewLine + new FileInfo(path).Length.ToString("X8")); + Util.Error("Attempted to load an unsupported file type/size.", + String.Format("File Loaded:{0}{1}", Environment.NewLine, path), + String.Format("File Size:{0}{1} bytes (0x{2})", Environment.NewLine, input.Length, input.Length.ToString("X4"))); } private void openMAIN(byte[] input, string path, bool ram = false) {