Skip to content

Commit

Permalink
Add nil check for smtpClient in checkConn function
Browse files Browse the repository at this point in the history
Previously, if smtpClient was nil, the checkConn function would not handle that case. This update ensures that an appropriate error is returned when smtpClient is nil, enhancing the robustness of the client connection checks.
  • Loading branch information
wneessen committed Oct 24, 2024
1 parent 5e3ebcc commit 4a8ac76
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,9 @@ func (c *Client) sendSingleMsg(message *Msg) error {
// - An error if there is no active connection, if the NOOP command fails, or if extending
// the deadline fails; otherwise, returns nil.
func (c *Client) checkConn() error {
if c.smtpClient == nil {
return ErrNoActiveConnection
}
if !c.smtpClient.HasConnection() {
return ErrNoActiveConnection
}
Expand Down

0 comments on commit 4a8ac76

Please sign in to comment.