]> sipb.mit.edu Git - ikiwiki.git/commitdiff
check that pagesources exists before testing
authorJoey Hess <joey@kitenet.net>
Fri, 7 May 2010 17:28:14 +0000 (13:28 -0400)
committerJoey Hess <joey@kitenet.net>
Fri, 7 May 2010 17:28:14 +0000 (13:28 -0400)
IkiWiki/Plugin/comments.pm

index 0a808aaeff9de1fb99dbe9cb2a150517cf59c48f..76f6551aef67cf7a67d3634906fe9e19cd9e13a1 100644 (file)
@@ -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");
                }
        }