chipzoller / hugo-clarity

A theme for Hugo based on VMware Clarity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Breaking bug: nil pointer evaluating at resource.Resource.MediaType

0xTanvir opened this issue · comments

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]

@0xTanvir Do you have the latest version? #305 fixed exactly this issue.

Sorry, my bad, I do not have the latest version, I have one week earlier version.