additional defensive check in EnforcementStatus

This commit is contained in:
Shivaram Lingamneni 2019-01-03 23:44:01 -05:00
parent efc0ce3b81
commit a52d167278
1 changed files with 4 additions and 0 deletions

View File

@ -187,6 +187,10 @@ func (am *AccountManager) EnforcementStatus(nick string) (account string, method
defer am.RUnlock() defer am.RUnlock()
account = am.nickToAccount[cfnick] account = am.nickToAccount[cfnick]
if account == "" {
method = NickReservationNone
return
}
method = am.accountToMethod[account] method = am.accountToMethod[account]
// if they don't have a custom setting, or customization is disabled, use the default // if they don't have a custom setting, or customization is disabled, use the default
if method == NickReservationOptional || !config.Accounts.NickReservation.AllowCustomEnforcement { if method == NickReservationOptional || !config.Accounts.NickReservation.AllowCustomEnforcement {