Browse Source

admin: fix possible nil pointer dereference

this possible bug was introduced in the previous commit
Nicola Murino 3 năm trước cách đây
mục cha
commit
b1d54f69d9
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      dataprovider/admin.go

+ 1 - 1
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
 	}
 }