diff --git a/PKHeX/MainWindow/Main.cs b/PKHeX/MainWindow/Main.cs index 376998540..baac26f8a 100644 --- a/PKHeX/MainWindow/Main.cs +++ b/PKHeX/MainWindow/Main.cs @@ -181,7 +181,10 @@ public Main() if (path != null && File.Exists(path)) openQuick(path, force: true); else + { openSAV(SAV, null); + SAV.Edited = false; // Prevents form close warning from showing until changes are made + } } // Splash Screen closes on its own. diff --git a/PKHeX/Misc/ErrorWindow.cs b/PKHeX/Misc/ErrorWindow.cs index ba03d6f23..ed617697e 100644 --- a/PKHeX/Misc/ErrorWindow.cs +++ b/PKHeX/Misc/ErrorWindow.cs @@ -18,7 +18,7 @@ public static DialogResult ShowErrorDialog(string friendlyMessage, Exception ex, var dialogResult = dialog.ShowDialog(); if (dialogResult == DialogResult.Abort) { - Application.Exit(); + Environment.Exit(1); } return dialogResult; } diff --git a/PKHeX/Saves/SaveUtil.cs b/PKHeX/Saves/SaveUtil.cs index 3b80c2820..791107953 100644 --- a/PKHeX/Saves/SaveUtil.cs +++ b/PKHeX/Saves/SaveUtil.cs @@ -544,7 +544,7 @@ public static string detectSaveFile() possiblePaths.AddRange(getSavesFromFolder(Path.Combine(pathCache), false)); // return newest save file path that is valid (oh man) - return possiblePaths.OrderByDescending(f => new FileInfo(f).LastWriteTime).FirstOrDefault(p => getVariantSAV(File.ReadAllBytes(p)).ChecksumsValid); + return possiblePaths.OrderByDescending(f => new FileInfo(f).LastWriteTime).FirstOrDefault(p => getVariantSAV(File.ReadAllBytes(p))?.ChecksumsValid ?? false); } /// /// Retrieves the full path of the most recent file based on LastWriteTime.