Fix nil pointer exception in group delete (#1211)

Fix group delete panic

In case if in the db the DNSSettings is null then can cause panic in delete group function
because this field is pointer and it was not checked. Because of in the future implementation
this variable will be filled in any case then make no sense to keep the pointer type.

Fix DNSSettings copy function
This commit is contained in:
Zoltan Papp
2023-10-11 23:00:56 +02:00
committed by GitHub
parent 659110f0d5
commit b8599f634c
5 changed files with 19 additions and 40 deletions

View File

@@ -26,7 +26,7 @@ const (
testDNSSettingsUserID = "test_user"
)
var baseExistingDNSSettings = &server.DNSSettings{
var baseExistingDNSSettings = server.DNSSettings{
DisabledManagementGroups: []string{testDNSSettingsExistingGroup},
}
@@ -43,7 +43,7 @@ func initDNSSettingsTestData() *DNSSettingsHandler {
return &DNSSettingsHandler{
accountManager: &mock_server.MockAccountManager{
GetDNSSettingsFunc: func(accountID string, userID string) (*server.DNSSettings, error) {
return testingDNSSettingsAccount.DNSSettings, nil
return &testingDNSSettingsAccount.DNSSettings, nil
},
SaveDNSSettingsFunc: func(accountID string, userID string, dnsSettingsToSave *server.DNSSettings) error {
if dnsSettingsToSave != nil {