From 2352776b781e221debf527fb59e65b4031de2363 Mon Sep 17 00:00:00 2001 From: Johan Lindh Date: Mon, 15 Jan 2024 11:55:47 +0100 Subject: [PATCH] preserve Write errors --- html.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/html.go b/html.go index dc00508..f2d24a9 100644 --- a/html.go +++ b/html.go @@ -66,12 +66,13 @@ func WriteHtmlInput(w io.Writer, jid jid.Jid, typeAttr, valueAttr string, attrs func WriteHtmlInner(w io.Writer, jid jid.Jid, htmlTag, typeAttr string, innerHtml template.HTML, attrs ...template.HTMLAttr) (err error) { if err = WriteHtmlTag(w, jid, htmlTag, typeAttr, "", attrs); err == nil { if innerHtml != "" || needClosingTag(htmlTag) { - w.Write([]byte(innerHtml)) - var b []byte - b = append(b, "') - w.Write(b) + if _, err = w.Write([]byte(innerHtml)); err == nil { + var b []byte + b = append(b, "') + _, err = w.Write(b) + } } } return @@ -79,9 +80,9 @@ func WriteHtmlInner(w io.Writer, jid jid.Jid, htmlTag, typeAttr string, innerHtm func WriteHtmlSelect(w io.Writer, jid jid.Jid, nba *NamedBoolArray, attrs []template.HTMLAttr) (err error) { if err = WriteHtmlTag(w, jid, "select", "", "", attrs); err == nil { + var b []byte nba.ReadLocked(func(nba []*NamedBool) { for _, nb := range nba { - var b []byte b = append(b, "\n