Tolerate NamespaceByID returning (nil,nil) when looking up an mfa enforcement's ns (#17562)

This commit is contained in:
Nick Cabatoff 2022-10-17 09:18:02 -04:00 committed by GitHub
parent 8a624c1264
commit f94bd10540
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

3
changelog/17562.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
core: prevent panic during mfa after enforcement's namespace is deleted
```

View File

@ -1693,7 +1693,7 @@ ECONFIG_LOOP:
if err != nil {
return nil, fmt.Errorf("failed to find the MFAEnforcementConfig namespace")
}
if eConfigNS.ID != ns.ID && !ns.HasParent(eConfigNS) {
if eConfig == nil || (eConfigNS.ID != ns.ID && !ns.HasParent(eConfigNS)) {
continue
}