Skip to content

Commit 4a8ac76

Browse files
author
Winni Neessen
committed
Add nil check for smtpClient in checkConn function
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.
1 parent 5e3ebcc commit 4a8ac76

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,9 @@ func (c *Client) sendSingleMsg(message *Msg) error {
12981298
// - An error if there is no active connection, if the NOOP command fails, or if extending
12991299
// the deadline fails; otherwise, returns nil.
13001300
func (c *Client) checkConn() error {
1301+
if c.smtpClient == nil {
1302+
return ErrNoActiveConnection
1303+
}
13011304
if !c.smtpClient.HasConnection() {
13021305
return ErrNoActiveConnection
13031306
}

0 commit comments

Comments
 (0)