diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2025-06-25 20:56:36 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2025-06-25 20:56:36 -0700 |
| commit | 5ec29c573bde2417b5d8788966af2577332ce0fc (patch) | |
| tree | f6f9c663c95ebd9699cf4dca7f7672489b50975d /internal | |
| parent | 23ddb9fca47a4a1923fc474db552418e3031b592 (diff) | |
Fix critical bug in YAMLAccountManager Update method
Move delete operation before modifying account.Login to prevent deleting wrong key from accounts map.
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/mobius/account_manager.go | 3 |
1 files changed, 1 insertions, 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) |