From: Cameron Moore Date: Sun, 15 Nov 2015 19:53:12 +0000 (-0600) Subject: Return error if shortcode template.Tree is nil X-Git-Tag: v0.15~30 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=05c29ad593b8e004c901fdca1f1b75864c1ac91a;p=brevno-suite%2Fhugo Return error if shortcode template.Tree is nil If a shortcode template fails to compile, the template will be non-nil, but template.Tree will be nil which caused a panic. --- diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go index 5fb9b7cc..e65a8598 100644 --- a/hugolib/shortcode.go +++ b/hugolib/shortcode.go @@ -343,6 +343,9 @@ Loop: if tmpl == nil { return sc, fmt.Errorf("Unable to locate template for shortcode '%s' in page %s", sc.name, p.BaseFileName()) } + if tmpl.Tree == nil { + return sc, fmt.Errorf("Template for shortcode '%s' failed to compile for page '%s'", sc.name, p.BaseFileName()) + } isInner = isInnerShortcode(tmpl) case tScParam: