mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-15 02:12:55 +01:00
Merge pull request #353 from sonalys/fix/close_panic
Fix(close): Access to nil variable causes panic
This commit is contained in:
commit
632ac17845
1 changed files with 1 additions and 1 deletions
|
@ -996,7 +996,7 @@ func (c *Client) DialWithContext(dialCtx context.Context) error {
|
|||
// Returns:
|
||||
// - An error if the disconnection fails; otherwise, returns nil.
|
||||
func (c *Client) Close() error {
|
||||
if !c.smtpClient.HasConnection() {
|
||||
if c.smtpClient == nil || !c.smtpClient.HasConnection() {
|
||||
return nil
|
||||
}
|
||||
if err := c.smtpClient.Quit(); err != nil {
|
||||
|
|
Loading…
Reference in a new issue