Skip to content

Commit

Permalink
Add missing nil check in html renderer
Browse files Browse the repository at this point in the history
Signed-off-by: Miek Gieben <[email protected]>
  • Loading branch information
miekg committed Jan 3, 2025
1 parent 3c9b4b8 commit b45c812
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions render/mhtml/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, `<dt class="bibliography-cite" id="`+string(bib.Anchor)+`">`+fmt.Sprintf("[%s]", bib.Anchor)+"</dt>\n")
io.WriteString(w, `<dd>`)
defer io.WriteString(w, "</dd>\n")
Expand All @@ -119,7 +119,7 @@ func bibliographyItem(w io.Writer, bib *mast.BibliographyItem, entering bool) {
if bib.Reference.Target != "" {
io.WriteString(w, `<a class="bliography-target" href="`+bib.Reference.Target+"\">"+bib.Reference.Target+"</a>\n")
}
if bib.Reference.Front.Date.Year != "" {
if bib.Reference.Front.Date != nil && bib.Reference.Front.Date.Year != "" {
io.WriteString(w, `<date class="bibliography-date">`+bib.Reference.Front.Date.Year+"</date>\n")
}
}
Expand Down

0 comments on commit b45c812

Please sign in to comment.