Skip to content

Commit

Permalink
Fix(close): Access to nil variable causes panic
Browse files Browse the repository at this point in the history
  • Loading branch information
sonalys authored Nov 6, 2024
1 parent 9ca7d24 commit 8c4eb62
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 8c4eb62

Please sign in to comment.