Breaking bug: nil pointer evaluating at resource.Resource.MediaType
0xTanvir opened this issue · comments
Tanvir Rahman commented
Actual error:
..................
/themes/hugo-clarity/layouts/partials/image.html:31:18":
execute of template failed: template: partials/image.html:31:18:
executing "partials/image.html" at <$image.MediaType.MainType>: nil pointer evaluating resource.Resource.MediaType
Why and how?
I was trying to render an image that was returning a 404 status code, So resources.GetRemote
was returned nil, and the site failed to build.
- render-image.html:21
- image.html:31
both of these places cause this error.
Hotfix :
I simply solved this by checking nil {{- if $image -}}
Desktop :
- OS: [wsl2, Windows 10]
- Browser [chrome 101.0.4951.67]
Ivan Boothe commented
Tanvir Rahman commented
Sorry, my bad, I do not have the latest version, I have one week earlier version.