Merge pull request #139 from wneessen/bugfix/138_segfault-in-writer-because-createpart-error-is-ignored

Fix nil pointer dereference in msgwriter due to missing error handling
This commit is contained in:
Winni Neessen 2023-08-08 11:10:31 +02:00 committed by GitHub
commit 05c2105705
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -231,9 +231,12 @@ func (mw *msgWriter) addFiles(fl []*File, a bool) {
if mw.d > 0 {
mw.newPart(f.Header)
}
if mw.err == nil {
mw.writeBody(f.Writer, e)
}
}
}
// newPart creates a new MIME multipart io.Writer and sets the partwriter to it
func (mw *msgWriter) newPart(h map[string][]string) {