Segmentation violation when not including .Inner in shortcode definition

Hello community,

I modified a shortcode of mine to no longer use {{ .Inner }}. This resulted in:

Building sites … panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x10aecd2]

My shortcode definition is:

{{ with $.Page.Site.Params.social }}
{{ $socialMap := $.Page.Site.Data.notrack.social }}
<div class="contactbox contactlinks
    {{- with .Get "float" }} {{ . }}{{ end -}}"
     style="
     {{- with .Get "width" }}width: {{ . }};{{ end -}}
     {{- with .Get "height" }}height: {{ . }};{{ end -}}">
    <ul>
    {{- $socialArray := slice -}}
    {{ range $website, $user := $.Site.Params.social }}
        {{- $social := $website | lower | index $socialMap | default dict -}}
        {{- $social := dict "user" $user | merge $social -}}
        {{- $socialArray = $socialArray | append $social -}}
    {{ end }}

    {{ range sort $socialArray "weight" -}}
        {{- if .prefix -}}
        <li><a href="{{- .prefix -}}{{ .user }}"><i class="{{- .icon.class -}}"></i>{{ .title }}</a></li>
        {{- else if .template -}}
        <li><a href="{{- printf .template .user -}}"><i class="{{- .icon.class -}}"></i>{{ .title }}</a></li>
        {{- end -}}
    {{- end -}}
    </ul>
</div>

{{ printf "<!-- Icons are from Awesome Font, licenced under SIL OFL 1.1 (https://scripts.sil.org/OFL) -->" | safeHTML }}

{{ end }}

When adding {{ .Inner }} somewhere again, the site compiles. Why is this happening and how can I fix it?

I had missed one old instance of using the shortcode in the content files with a closing tag. Removing that solved it.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.