From 5ec29c573bde2417b5d8788966af2577332ce0fc Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Wed, 25 Jun 2025 20:56:36 -0700 Subject: Fix critical bug in YAMLAccountManager Update method Move delete operation before modifying account.Login to prevent deleting wrong key from accounts map. --- internal/mobius/account_manager.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/mobius/account_manager.go b/internal/mobius/account_manager.go index 6bbc951..72984b7 100644 --- a/internal/mobius/account_manager.go +++ b/internal/mobius/account_manager.go @@ -114,10 +114,9 @@ func (am *YAMLAccountManager) Update(account hotline.Account, newLogin string) e return fmt.Errorf("error renaming account file: %w", err) } + delete(am.accounts, account.Login) account.Login = newLogin am.accounts[newLogin] = account - - delete(am.accounts, account.Login) } out, err := yaml.Marshal(&account) -- cgit