From b279ac0d5e29a0d2ed2848046bf07ece1a87122e Mon Sep 17 00:00:00 2001 From: rootdarkarchon Date: Sun, 13 Aug 2023 13:23:43 +0200 Subject: [PATCH] fix add character when no secret key --- MareSynchronos/UI/CompactUI.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MareSynchronos/UI/CompactUI.cs b/MareSynchronos/UI/CompactUI.cs index 097f94e..c6d5a11 100644 --- a/MareSynchronos/UI/CompactUI.cs +++ b/MareSynchronos/UI/CompactUI.cs @@ -49,7 +49,7 @@ public class CompactUi : WindowMediatorSubscriberBase private Vector2 _lastPosition = Vector2.One; private Vector2 _lastSize = Vector2.One; private string _pairToAdd = string.Empty; - private int _secretKeyIdx = 0; + private int _secretKeyIdx = -1; private bool _showModalForUserAddition; private bool _showSyncShells; private bool _wasOpen; @@ -222,8 +222,9 @@ public class CompactUi : WindowMediatorSubscriberBase { ImGui.Dummy(new(10)); var keys = _serverManager.CurrentServer!.SecretKeys; - if (keys.TryGetValue(_secretKeyIdx, out var secretKey)) + if (keys.Any()) { + if (_secretKeyIdx == -1) _secretKeyIdx = keys.First().Key; if (UiSharedService.IconTextButton(FontAwesomeIcon.Plus, "Add current character with secret key")) { _serverManager.CurrentServer!.Authentications.Add(new MareConfiguration.Models.Authentication()