gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
76.03k stars 7.54k forks source link

nil pointer evaluating resource.Resource.Exif in shortcode #13026

Closed rumpelsepp closed 2 weeks ago

rumpelsepp commented 2 weeks ago
$ hugo version
hugo v0.138.0-ad82998d54b3f9f8c2741b67356813b55b3134b9+extended linux/amd64 BuildDate=2024-11-06T11:22:34Z VendorInfo=gohugoio

I get the following error:

execute of template failed: template: shortcodes/fig.html:9:12: executing "shortcodes/fig.html" at <$img.Exif>: nil pointer evaluating resource.Resource.Exif

using this template (zipped because auf github): fig.html.zip

The relevant line is this:

{{ with $img.Exif }}

I figure this should not fail with a nil pointer.

The image is this one: image.jpg.zip

rumpelsepp commented 2 weeks ago

Ok, it is partially my fault. After debugging this, I found out that the error appears when the image does not exist. This is a bug in my shortcode, I guess. Sorry for opening this report.