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.
This commit is contained in:
Cameron Moore 2015-11-15 13:53:12 -06:00 committed by Bjørn Erik Pedersen
parent e59aabcf46
commit 05c29ad593

View file

@ -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: