shithub: hugo

Download patch

ref: 05c29ad593b8e004c901fdca1f1b75864c1ac91a
parent: e59aabcf4615b28e3c4224d7a9bbbc1a3091a69c
author: Cameron Moore <[email protected]>
date: Sun Nov 15 08:53:12 EST 2015

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.

--- a/hugolib/shortcode.go
+++ b/hugolib/shortcode.go
@@ -343,6 +343,9 @@
 			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: