From b45c812c1654f8844d000e4f30103bff2dbe6406 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 3 Jan 2025 10:04:42 +0100 Subject: [PATCH] Add missing nil check in html renderer Signed-off-by: Miek Gieben --- render/mhtml/hook.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/render/mhtml/hook.go b/render/mhtml/hook.go index 1d76efc..1e6ea18 100644 --- a/render/mhtml/hook.go +++ b/render/mhtml/hook.go @@ -105,7 +105,7 @@ func (r RendererOptions) RenderHook(w io.Writer, node ast.Node, entering bool) ( return ast.GoToNext, false } -func bibliographyItem(w io.Writer, bib *mast.BibliographyItem, entering bool) { +func bibliographyItem(w io.Writer, bib *mast.BibliographyItem, _ bool) { io.WriteString(w, `
`+fmt.Sprintf("[%s]", bib.Anchor)+"
\n") io.WriteString(w, `
`) defer io.WriteString(w, "
\n") @@ -119,7 +119,7 @@ func bibliographyItem(w io.Writer, bib *mast.BibliographyItem, entering bool) { if bib.Reference.Target != "" { io.WriteString(w, `"+bib.Reference.Target+"\n") } - if bib.Reference.Front.Date.Year != "" { + if bib.Reference.Front.Date != nil && bib.Reference.Front.Date.Year != "" { io.WriteString(w, ``+bib.Reference.Front.Date.Year+"\n") } }