From 05c29ad593b8e004c901fdca1f1b75864c1ac91a Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Sun, 15 Nov 2015 13:53:12 -0600 Subject: [PATCH] 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. --- hugolib/shortcode.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go index 5fb9b7cc8..e65a85989 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: