Skip to content

Commit

Permalink
Merge pull request #353 from sonalys/fix/close_panic
Browse files Browse the repository at this point in the history
Fix(close): Access to nil variable causes panic
  • Loading branch information
wneessen authored Nov 6, 2024
2 parents 9ca7d24 + 8c4eb62 commit 632ac17
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 632ac17

Please sign in to comment.