mirror of
https://github.com/argoproj/argo-cd
synced 2026-05-24 09:50:08 +00:00
* Issue #414 - fix nil pointer in 'argocd cluster add' * Add missing nil check
This commit is contained in:
parent
48ef2e919e
commit
273f99b293
1 changed files with 11 additions and 0 deletions
|
|
@ -109,9 +109,20 @@ func printKubeContexts(ca clientcmd.ConfigAccess) {
|
|||
}
|
||||
sort.Strings(contextNames)
|
||||
|
||||
if config.Clusters == nil {
|
||||
return
|
||||
}
|
||||
|
||||
for _, name := range contextNames {
|
||||
// ignore malformed kube config entries
|
||||
context := config.Contexts[name]
|
||||
if context == nil {
|
||||
continue
|
||||
}
|
||||
cluster := config.Clusters[context.Cluster]
|
||||
if cluster == nil {
|
||||
continue
|
||||
}
|
||||
prefix := " "
|
||||
if config.CurrentContext == name {
|
||||
prefix = "*"
|
||||
|
|
|
|||
Loading…
Reference in a new issue