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 authored and Bjørn Erik Pedersen committed 2015-11-20 23:34:30 +01:00
1 parent e59aabcf46
commit 05c29ad593
1 file changed
+3
+3
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: