mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Avoid accessing .Items on nil object
When listing fails for whatever reason, the return value is nil, err. so handle err explicitly. Signed-off-by: Dirk Müller <dirk@dmllr.de>
This commit is contained in:
parent
8d70995503
commit
9cd40c612a
1 changed files with 4 additions and 1 deletions
|
|
@ -455,5 +455,8 @@ func getPods(ctx context.Context, client kubernetes.Interface, namespace, select
|
|||
list, err := client.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{
|
||||
LabelSelector: selector,
|
||||
})
|
||||
return list.Items, err
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to list pods: %w", err)
|
||||
}
|
||||
return list.Items, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue