Skip to content

Commit

Permalink
fix nil-dereference if active cluster refers to non-existing cluster …
Browse files Browse the repository at this point in the history
…entry
  • Loading branch information
birdayz committed Nov 22, 2018
1 parent e94dd35 commit f858639
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ type Config struct {
}

func (c *Config) SetCurrentCluster(name string) error {
oldCluster := c.ActiveCluster().Name
var oldCluster string
if c.ActiveCluster() != nil {
oldCluster = c.ActiveCluster().Name
}
for _, cluster := range c.Clusters {
if cluster.Name == name {
c.CurrentCluster = name
Expand Down

0 comments on commit f858639

Please sign in to comment.