From c0ce830bab8cdc46728fa68b3a0a175e1eb188b2 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 31 Jul 2018 15:03:36 +0200 Subject: [PATCH] messageWriter: don't ignore error in writeString fixes #30 --- writeto.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/writeto.go b/writeto.go index be1b175..faf6124 100644 --- a/writeto.go +++ b/writeto.go @@ -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) }