mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-15 02:12:55 +01:00
Add nil check in testMessage helper function
Added a conditional check to ensure 'NewMsg()' does not return nil in the 'testMessage' helper function. This update will prevent potential nil pointer dereferences and improve the robustness of the test.
This commit is contained in:
parent
42c63791ef
commit
cf117d320b
1 changed files with 3 additions and 0 deletions
|
@ -3527,6 +3527,9 @@ func parseJSONLog(t *testing.T, buf *bytes.Buffer) logData {
|
|||
func testMessage(t *testing.T) *Msg {
|
||||
t.Helper()
|
||||
message := NewMsg()
|
||||
if message == nil {
|
||||
t.Fatal("failed to create new message")
|
||||
}
|
||||
if err := message.From(TestSenderValid); err != nil {
|
||||
t.Errorf("failed to set sender address: %s", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue