3
0
mirror of https://github.com/ergochat/ergo.git synced 2025-01-22 18:24:17 +01:00

Merge pull request #1811 from slingamn/error_line

fix spurious "corrupt account creds" logline
This commit is contained in:
Shivaram Lingamneni 2021-11-01 23:24:13 -04:00 committed by GitHub
commit 62043afbb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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