From 6652058ee3b3c582cbce7a825999fd296a2de129 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sun, 4 Oct 2026 19:24:07 -0700 Subject: [PATCH] fix invalid/old auth methods crashing the launcher --- SS14.Launcher/Models/Logins/LoginManager.cs | 4 +++- SS14.Launcher/Views/SelectAccountDialog.xaml.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SS14.Launcher/Models/Logins/LoginManager.cs b/SS14.Launcher/Models/Logins/LoginManager.cs index efb7cb5b..15d839ef 100644 --- a/SS14.Launcher/Models/Logins/LoginManager.cs +++ b/SS14.Launcher/Models/Logins/LoginManager.cs @@ -196,7 +196,9 @@ private async Task UpdateSingleAccountStatus(ActiveLoginData data) public static ConfigConstants.AuthServer GetAuthServerById(string serverId, string? customAuthUrl = null, string? customAccountSite = null) { if (serverId != ConfigConstants.CustomAuthServer) - return ConfigConstants.AuthUrls[serverId]; + return ConfigConstants.AuthUrls.TryGetValue(serverId, out var server) + ? server + : ConfigConstants.AuthUrls[ConfigConstants.FallbackAuthServer]; if (customAuthUrl == null) throw new ArgumentException("Custom server selected but no custom URLs provided."); diff --git a/SS14.Launcher/Views/SelectAccountDialog.xaml.cs b/SS14.Launcher/Views/SelectAccountDialog.xaml.cs index 85c238ef..d2ccaf10 100644 --- a/SS14.Launcher/Views/SelectAccountDialog.xaml.cs +++ b/SS14.Launcher/Views/SelectAccountDialog.xaml.cs @@ -25,7 +25,9 @@ public SelectAccountDialog(string[] authMethods, LoginManager loginManager) _loginMgr = loginManager; Accounts = _loginMgr.Logins.KeyValues - .Where(x => authMethods.FirstOrDefault(m => m == ConfigConstants.AuthUrls[x.Value.Server].AuthUrl.AbsoluteUri) != null) + .Where(x => authMethods.FirstOrDefault(m => + ConfigConstants.AuthUrls.TryGetValue(x.Value.Server, out var server) + && m == server.AuthUrl.AbsoluteUri) != null) .Select(x => x.Value); Error = !Accounts.Any(); Description = _loc.GetString("select-account-dialog-description", ("allowedAuths", string.Join(", ", authMethods.Select(m => ConfigConstants.AuthUrls.FirstOrDefault(kv => kv.Value.AuthUrl.AbsoluteUri == m).Key))));