Merge pull request #2570 from dgageot/2280-prevent-nil-dereference

2280 prevent nil dereference
This commit is contained in:
Jean-Laurent de Morlhon
2015-12-14 15:36:29 +01:00

View File

@@ -80,13 +80,15 @@ func cmdLs(c CommandLine, api libmachine.API) error {
fmt.Fprintln(w, "NAME\tACTIVE\tDRIVER\tSTATE\tURL\tSWARM\tDOCKER\tERRORS")
for _, host := range hostList {
swarmOptions := host.HostOptions.SwarmOptions
if swarmOptions.Master {
swarmMasters[swarmOptions.Discovery] = host.Name
}
if host.HostOptions != nil {
swarmOptions := host.HostOptions.SwarmOptions
if swarmOptions.Master {
swarmMasters[swarmOptions.Discovery] = host.Name
}
if swarmOptions.Discovery != "" {
swarmInfo[host.Name] = swarmOptions.Discovery
if swarmOptions.Discovery != "" {
swarmInfo[host.Name] = swarmOptions.Discovery
}
}
}