From be0c2df6db1e30b4ee4213f402a1414e2e2abd85 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 7 May 2010 13:28:14 -0400 Subject: [PATCH] check that pagesources exists before testing --- IkiWiki/Plugin/comments.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 0a808aaef..76f6551ae 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -907,9 +907,9 @@ sub match_comment ($$;@) { my $glob = shift; my $match=match_glob($page, "$glob/*", internal => 1, @_); - if ($match) { + if ($match && exists $IkiWiki::pagesources{$page}) { my $type=IkiWiki::pagetype($IkiWiki::pagesources{$page}); - if ($type ne "_comment") { + if (defined $type && $type ne "_comment") { return IkiWiki::FailReason->new("$page is not a comment"); } } @@ -921,9 +921,9 @@ sub match_comment_pending ($$;@) { my $glob = shift; my $match=match_glob($page, "$glob/*", internal => 1, @_); - if ($match) { + if ($match && $IkiWiki::pagesources{$page}) { my $type=IkiWiki::pagetype($IkiWiki::pagesources{$page}); - if ($type ne "_comment_pending") { + if (defined $type && $type ne "_comment_pending") { return IkiWiki::FailReason->new("$page is not a pending comment"); } } -- 2.26.2