do not crash on failed connect

This commit is contained in:
Stanislav Seletskiy 2014-12-11 16:41:59 +06:00
parent 15ac96c029
commit a60980a550

View File

@ -224,7 +224,11 @@ func NewClientNoTLS(host, user, passwd string, debug bool) (*Client, error) {
}
func (c *Client) Close() error {
return c.conn.Close()
if c.conn != (*tls.Conn)(nil) {
return c.conn.Close()
} else {
return nil
}
}
func saslDigestResponse(username, realm, passwd, nonce, cnonceStr,