From 8fb831ef7c1922d428b34f9a9fb71e7a7a4f608c Mon Sep 17 00:00:00 2001 From: DismissedLight <1686188646@qq.com> Date: Wed, 3 Jan 2024 19:58:02 +0800 Subject: [PATCH] fix startup launch game card crash --- .../Snap.Hutao/ViewModel/Game/LaunchGameShared.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameShared.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameShared.cs index ba8e48c5e2..e7a8506127 100644 --- a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameShared.cs +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameShared.cs @@ -13,7 +13,16 @@ internal static class LaunchGameShared { public static LaunchScheme? GetCurrentLaunchSchemeFromConfigFile(IGameServiceFacade gameService, IInfoBarService infoBarService) { - ChannelOptions options = gameService.GetChannelOptions(); + ChannelOptions options; + try + { + options = gameService.GetChannelOptions(); + } + catch (InvalidOperationException) + { + return default; + } + if (string.IsNullOrEmpty(options.ConfigFilePath)) { try