Issue #414 - fix nil pointer in 'argocd cluster add' (#416)

* Issue #414 - fix nil pointer in 'argocd cluster add'

* Add missing nil check
This commit is contained in:
Alexander Matyushentsev 2018-07-16 23:54:12 +03:00 committed by GitHub
parent 48ef2e919e
commit 273f99b293
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 = "*"