From: Joey Hess Date: Fri, 7 May 2010 17:28:14 +0000 (-0400) Subject: check that pagesources exists before testing X-Git-Tag: 3.20100515~70 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=be0c2df6db1e30b4ee4213f402a1414e2e2abd85;p=ikiwiki.git check that pagesources exists before testing --- 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"); } }