fix check e != nil but return a nil value error err (#3038)

the err has been checked in line 199
mine
alingse 2025-01-12 23:28:03 +08:00 committed by GitHub
parent 951b6c0118
commit 287adc3a6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -204,7 +204,7 @@ func (p *Policy) fetchClusterRoles() ([]rbacv1.ClusterRole, error) {
for i, o := range oo { for i, o := range oo {
var cr rbacv1.ClusterRole var cr rbacv1.ClusterRole
if e := runtime.DefaultUnstructuredConverter.FromUnstructured(o.(*unstructured.Unstructured).Object, &cr); e != nil { if e := runtime.DefaultUnstructuredConverter.FromUnstructured(o.(*unstructured.Unstructured).Object, &cr); e != nil {
return nil, err return nil, e
} }
crs[i] = cr crs[i] = cr
} }