Skip to content

Commit

Permalink
Check the correct error in d.downloadAPIs
Browse files Browse the repository at this point in the history
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: f8b99b1f09fb5d4d10b15e326c4b242cc705f007
  • Loading branch information
hoskeri authored and k8s-publishing-bot committed Dec 11, 2022
1 parent 236db3c commit a2ef324
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion discovery/discovery_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a2ef324

Please sign in to comment.