diff --git a/xmpp.go b/xmpp.go index fa39d0a..ec4f7d1 100644 --- a/xmpp.go +++ b/xmpp.go @@ -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,