Skip to content

Commit

Permalink
messageWriter: don't ignore error in writeString
Browse files Browse the repository at this point in the history
fixes #30

[Ivy: add changelog entry]
  • Loading branch information
cryptix authored and ivy committed Jul 31, 2018
1 parent c55e3fb commit a0242b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

- #26: Fixes RFC 1341 compliance by properly capitalizing the
`MIME-Version` header.
- #30: Fixes IO errors being silently dropped in `Message.WriteTo`.

## [2.2.0] - 2018-03-01

Expand Down
6 changes: 5 additions & 1 deletion writeto.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ func (w *messageWriter) Write(p []byte) (int, error) {
}

func (w *messageWriter) writeString(s string) {
n, _ := io.WriteString(w.w, s)
if w.err != nil { // do nothing when in error
return
}
var n int
n, w.err = io.WriteString(w.w, s)
w.n += int64(n)
}

Expand Down

0 comments on commit a0242b2

Please sign in to comment.