commit 05c29ad593b8e004c901fdca1f1b75864c1ac91a
parent e59aabcf4615b28e3c4224d7a9bbbc1a3091a69c
Author: Cameron Moore <moorereason@gmail.com>
Date: Sun, 15 Nov 2015 13:53:12 -0600
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.
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git 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: