From b1d54f69d94e193fdf9b771bc0e5151edc038e78 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sat, 4 Sep 2021 13:56:29 +0200 Subject: [PATCH] admin: fix possible nil pointer dereference this possible bug was introduced in the previous commit --- dataprovider/admin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dataprovider/admin.go b/dataprovider/admin.go index b240cebe..4d9f4136 100644 --- a/dataprovider/admin.go +++ b/dataprovider/admin.go @@ -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 } }