mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
Fix nilpointer on ToC heading
Fixes #11843 Co-authored-by: Joe Mooring <joe.mooring@veriphor.com>
This commit is contained in:
@@ -121,3 +121,16 @@ CONTENT
|
||||
b, _ = hugolib.TestE(t, files)
|
||||
b.AssertLogMatches(`error calling ToHTML: startLevel: unable to cast "x" of type string`)
|
||||
}
|
||||
|
||||
func TestHeadingsNilpointerIssue11843(t *testing.T) {
|
||||
t.Parallel()
|
||||
files := `
|
||||
-- hugo.toml --
|
||||
-- layouts/home.html --
|
||||
{{ $h := index .Fragments.HeadingsMap "bad_id" }}
|
||||
{{ if not $h }}OK{{ end }}
|
||||
`
|
||||
b := hugolib.Test(t, files)
|
||||
|
||||
b.AssertFileContent("public/index.html", "OK")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user