]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/comments.pm
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
[git.ikiwiki.info.git] / IkiWiki / Plugin / comments.pm
index de193bd12b358d2850a823c3e492af1844b4a292..b244a74313ef80b376037895915ab75bab222088 100644 (file)
@@ -433,7 +433,8 @@ sub editcomment ($$) {
 
        $content .= " date=\"" . decode_utf8(strftime('%Y-%m-%dT%H:%M:%SZ', gmtime)) . "\"\n";
 
-       my $editcontent = $form->field('editcontent') || '';
+       my $editcontent = $form->field('editcontent');
+       $editcontent="" if ! defined $editcontent;
        $editcontent =~ s/\r\n/\n/g;
        $editcontent =~ s/\r/\n/g;
        $editcontent =~ s/"/\\"/g;
@@ -913,8 +914,8 @@ sub match_comment ($$;@) {
        my $source=exists $IkiWiki::pagesources{$page} ?
                $IkiWiki::pagesources{$page} :
                $IkiWiki::delpagesources{$page};
-       my $type=IkiWiki::pagetype($source);
-       if (defined $type && $type ne "_comment") {
+       my $type=defined $source ? IkiWiki::pagetype($source) : undef;
+       if (! defined $type || $type ne "_comment") {
                return IkiWiki::FailReason->new("$page is not a comment");
        }
 
@@ -928,8 +929,8 @@ sub match_comment_pending ($$;@) {
        my $source=exists $IkiWiki::pagesources{$page} ?
                $IkiWiki::pagesources{$page} :
                $IkiWiki::delpagesources{$page};
-       my $type=IkiWiki::pagetype($source);
-       if (defined $type && $type ne "_comment_pending") {
+       my $type=defined $source ? IkiWiki::pagetype($source) : undef;
+       if (! defined $type || $type ne "_comment_pending") {
                return IkiWiki::FailReason->new("$page is not a pending comment");
        }