mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-22 05:40:50 +01:00
Add null check to prevent empty file handle error in msg_test.go
Implemented a null check to ensure the 'fi' file handle is not empty. With the absence of this check, the test was continuing even when 'fi' was empty, leading to null pointer exceptions further down in the code.
This commit is contained in:
parent
ddcad3710d
commit
5dcbe712ae
1 changed files with 4 additions and 0 deletions
|
@ -2589,6 +2589,10 @@ func TestMsg_WriteToFile(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Errorf("failed to stat output file: %s", err)
|
||||
}
|
||||
if fi == nil {
|
||||
t.Errorf("received empty file handle")
|
||||
return
|
||||
}
|
||||
if fi.Size() <= 0 {
|
||||
t.Errorf("output file is expected to contain data but its size is zero")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue