avoid fatal error if aggregate page template could not be found
authorJoey Hess <joey@kitenet.net>
Mon, 27 Sep 2010 19:44:04 +0000 (15:44 -0400)
committerJoey Hess <joey@kitenet.net>
Mon, 27 Sep 2010 19:44:04 +0000 (15:44 -0400)
That template is user-controlled.

IkiWiki/Plugin/aggregate.pm

index fe53d868dbad39d455f59b45c91af54b4ee156cd..9b70e5df053731866c5ad7a494432e6e0b72b4bc 100644 (file)
@@ -644,7 +644,14 @@ sub add_page (@) {
        $guid->{md5}=$digest;
 
        # Create the page.
-       my $template=template($feed->{template}, blind_cache => 1);
+       my $template;
+       eval {
+               $template=template($feed->{template}, blind_cache => 1);
+       };
+       if ($@) {
+               print STDERR gettext("failed to process template:")." $@";
+               return;
+       }
        $template->param(title => $params{title})
                if defined $params{title} && length($params{title});
        $template->param(content => wikiescape(htmlabs($params{content},