mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-22 13:50:49 +01:00
Add validation for nil STDERR or STDIN pipe
Introduced a new condition that checks and returns an error if either STDERR or STDIN pipe is nil in the msg function of msg.go. This improves error handling by preventing potential panic due to referencing a nil pipe.
This commit is contained in:
parent
1a166770b7
commit
a50a3ceb18
1 changed files with 3 additions and 0 deletions
3
msg.go
3
msg.go
|
@ -1001,6 +1001,9 @@ func (m *Msg) WriteToSendmailWithContext(ctx context.Context, sp string, a ...st
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to set STDIN pipe: %w", err)
|
||||
}
|
||||
if se == nil || si == nil {
|
||||
return fmt.Errorf("received nil for STDERR or STDIN pipe")
|
||||
}
|
||||
|
||||
// Start the execution and write to STDIN
|
||||
if err = ec.Start(); err != nil {
|
||||
|
|
Loading…
Reference in a new issue