From 1b244e6317066e2877106f2efe29dea7d79160d4 Mon Sep 17 00:00:00 2001 From: SirCxyrtyx Date: Tue, 21 Feb 2023 21:17:54 -0800 Subject: [PATCH] exit gracefully if no game is selected during first-time setup --- FModel/ViewModels/ApplicationViewModel.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/FModel/ViewModels/ApplicationViewModel.cs b/FModel/ViewModels/ApplicationViewModel.cs index a9f58e26..81cbf32a 100644 --- a/FModel/ViewModels/ApplicationViewModel.cs +++ b/FModel/ViewModels/ApplicationViewModel.cs @@ -73,6 +73,12 @@ public class ApplicationViewModel : ViewModel LoadingModes = new LoadingModesViewModel(); AvoidEmptyGameDirectoryAndSetEGame(false); + if (UserSettings.Default.GameDirectory is null) + { + //If no game is selected, many things will break before a shutdown request is processed in the normal way. + //A hard exit is preferable to an unhandled expection in this case + Environment.Exit(0); + } CUE4Parse = new CUE4ParseViewModel(UserSettings.Default.GameDirectory); CustomDirectories = new CustomDirectoriesViewModel(CUE4Parse.Game, UserSettings.Default.GameDirectory); SettingsView = new SettingsViewModel(CUE4Parse.Game);