fix add character when no secret key

This commit is contained in:
rootdarkarchon
2023-08-13 13:23:43 +02:00
parent b65ae8fca3
commit b279ac0d5e

View File

@@ -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()