admin: fix possible nil pointer dereference

this possible bug was introduced in the previous commit
This commit is contained in:
Nicola Murino 2021-09-04 13:56:29 +02:00
parent 374de07c7b
commit b1d54f69d9
No known key found for this signature in database
GPG key ID: 2F1FB59433D5A8CB

View file

@ -305,7 +305,7 @@ func (a *Admin) SetEmptySecretsIfNil() {
// This is useful before rendering as JSON so the empty fields
// will not be serialized.
func (a *Admin) SetNilSecretsIfEmpty() {
if a.Filters.TOTPConfig.Secret.IsEmpty() {
if a.Filters.TOTPConfig.Secret != nil && a.Filters.TOTPConfig.Secret.IsEmpty() {
a.Filters.TOTPConfig.Secret = nil
}
}