mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-22 05:40:50 +01:00
Fix(close): Access to nil variable causes panic
This commit is contained in:
parent
9ca7d24f6a
commit
8c4eb62360
1 changed files with 1 additions and 1 deletions
|
@ -996,7 +996,7 @@ func (c *Client) DialWithContext(dialCtx context.Context) error {
|
||||||
// Returns:
|
// Returns:
|
||||||
// - An error if the disconnection fails; otherwise, returns nil.
|
// - An error if the disconnection fails; otherwise, returns nil.
|
||||||
func (c *Client) Close() error {
|
func (c *Client) Close() error {
|
||||||
if !c.smtpClient.HasConnection() {
|
if c.smtpClient == nil || !c.smtpClient.HasConnection() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err := c.smtpClient.Quit(); err != nil {
|
if err := c.smtpClient.Quit(); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue