3
0
mirror of https://github.com/ergochat/ergo.git synced 2025-02-03 08:04:06 +01:00

fix spurious "corrupt account creds" logline

Reported by @tacerus. This was most likely introduced by 8b2f6de3e.
This commit is contained in:
Shivaram Lingamneni 2021-11-01 18:48:37 -04:00
parent 84a5b83eb1
commit 61bce74018

View File

@ -177,13 +177,13 @@ func (am *AccountManager) buildNickToAccountIndex(config *Config) {
}
}
if rawPrefs, err := tx.Get(fmt.Sprintf(keyAccountSettings, account)); err == nil {
if rawPrefs, err := tx.Get(fmt.Sprintf(keyAccountSettings, account)); err == nil && rawPrefs != "" {
var prefs AccountSettings
err := json.Unmarshal([]byte(rawPrefs), &prefs)
if err == nil && prefs.NickEnforcement != NickEnforcementOptional {
accountToMethod[account] = prefs.NickEnforcement
} else if err != nil {
am.server.logger.Error("internal", "corrupt account creds", account)
am.server.logger.Error("internal", "corrupt account settings", account, err.Error())
}
}