Check the correct error in d.downloadAPIs

The error result of `d.downloadAPIs()` is set in `aerr`,
not `err`.

This prevents a nil-ptr dereference of apiGroups in the next step.

Signed-off-by: Abhijit Hoskeri <abhijithoskeri@gmail.com>

Kubernetes-commit: 450ba4f50638ad9ee4d287a762a8530c64e89ebd
This commit is contained in:
Abhijit Hoskeri
2022-12-10 16:32:02 -08:00
committed by Kubernetes Publisher
parent 58ff029093
commit 4dbb1cd1d5

View File

@@ -196,7 +196,7 @@ func (d *DiscoveryClient) GroupsAndMaybeResources() (*metav1.APIGroupList, map[s
}
// Discovery groups and (possibly) resources downloaded from /apis.
apiGroups, apiResources, aerr := d.downloadAPIs()
if err != nil {
if aerr != nil {
return nil, nil, aerr
}
// Merge apis groups into the legacy groups.