diff --git a/client.go b/client.go index 1ab9e14d..3d3ef2ed 100644 --- a/client.go +++ b/client.go @@ -585,7 +585,9 @@ func (c *Client) CloseWithContext(ctx context.Context) error { // close the connection but ignore the error since there isn't // anything we can do about it anyway - c.conn.Close() + if c.conn != nil { + c.conn.Close() + } return nil }