From 31f0e459b8143cd986f04d122d255f4d0f44a505 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 20 Nov 2010 14:54:43 -0400 Subject: [PATCH] edittemplate: Fix crash if using a .tmpl file or other non-page file as a template for a new page. --- IkiWiki/Plugin/edittemplate.pm | 6 ++++-- debian/changelog | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm index 576c94be4..061242fd8 100644 --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm @@ -107,9 +107,11 @@ sub formbuilder (@) { my $template=$pagestate{$registering_page}{edittemplate}{$pagespec}; $form->field(name => "editcontent", value => filltemplate($template, $page)); - $form->field(name => "type", - value => pagetype($pagesources{$template})) + my $type=pagetype($pagesources{$template}) if $pagesources{$template}; + $form->field(name => "type", + value => $type) + if defined $type; return; } } diff --git a/debian/changelog b/debian/changelog index ecd028a0c..d236361d2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,8 @@ ikiwiki (3.20101113) UNRELEASED; urgency=low * Optimise glob() pagespec. (Thanks, Kathryn and smcv) * highlight: Support new format of filetypes.conf used by version 3.2 of the highlight package. + * edittemplate: Fix crash if using a .tmpl file or other non-page file + as a template for a new page. -- Joey Hess Tue, 16 Nov 2010 14:23:47 -0400 -- 2.39.5