FIX #2280 prevent nil dereference

Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
David Gageot
2015-12-14 12:22:14 +01:00
parent 5af18c9972
commit f66655fd77

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
}
}
}