From 4a8ac76636d2ae894f6bffbc7c89b83c36caa90f Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 24 Oct 2024 10:44:40 +0200 Subject: [PATCH] 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. --- client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client.go b/client.go index 55280b6..3e26e9f 100644 --- a/client.go +++ b/client.go @@ -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 }