fix nil ptr exception

This commit is contained in:
Matthew Hooker 2017-10-05 16:34:13 -07:00
parent afd394e0bd
commit 2a326b5172
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 1 additions and 1 deletions

View File

@ -165,10 +165,10 @@ func (d *ESX5Driver) Verify() error {
func (d *ESX5Driver) HostIP() (string, error) {
conn, err := net.Dial("tcp", fmt.Sprintf("%s:%d", d.Host, d.Port))
defer conn.Close()
if err != nil {
return "", err
}
defer conn.Close()
host, _, err := net.SplitHostPort(conn.LocalAddr().String())
return host, err