I have recently encountered this upon upgrading to High Sierra and have also upgraded Hugo:
Building sites … ERROR 2018/02/01 18:38:22 Failed to render “theme/_default/list.html”: runtime error: invalid memory address or nil pointer dereference
While everything works, I’m worried this error might escalate.
Are there ways of debugging this? Are there ways of putting bookmarks in files and see exactly which folder is generating this error?
The Hugo --verbose output is not helpful as it gives this error and nothing else. I tried looking at the changelog for this version but I could not figure out what might be the issue. This is the output for hugo version:
Hugo Static Site Generator v0.35 darwin/amd64 BuildDate:
Thanks,
EDIT: I just discovered that Hugo is not building the .xml files, so all is not well.
You need to post a link to the source code of your site for others to see what’s wrong in your list template.
Never leave Hugo console errors unresolved and hope for the best.
If you use version control you can find out the exact source of this problem relatively quickly.
Thanks! Actually I hadn’t changed the code, just updated Hugo.
Upon manually debugging every single line I found the source of error:
<a class="crosslink categories date" href="{{ .Parent.RelPermalink }}">{{ .CurrentSection.Title }}</a>
This is inside a
{{ range .Paginator.Pages}} {{ end }}
Once I delete this line there’s no longer a nil pointer dereference. This had worked so far (my previous version of Hugo was .31.1) but not any more.
What should this code be changed to in the newer version?
(It would be great if these errors had more details)
The following hack worked:
I nested the code inside
{{if eq .Type "post" }} {{ end }}