Skip to content

Commit a92953f

Browse files
author
James Westby
committed
Fix a crash bug when REST config can't be loaded
`discoveryClient` is uninitialized, so the pointer can't be deferenced, so return an empty struct if there's an error.
1 parent d2ceb54 commit a92953f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/datagatherer/k8s/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func NewDiscoveryClient(kubeconfigPath string) (discovery.DiscoveryClient, error
3333

3434
cfg, err := loadRESTConfig(kubeconfigPath)
3535
if err != nil {
36-
return *discoveryClient, errors.WithStack(err)
36+
return discovery.DiscoveryClient{}, errors.WithStack(err)
3737
}
3838

3939
discoveryClient, err = discovery.NewDiscoveryClientForConfig(cfg)

0 commit comments

Comments
 (0)