fix undef warning when page() tests a deleted file

master
Joey Hess 2010-05-07 13:25:32 -04:00
parent 888ac35e11
commit b01a2274c3
2 changed files with 5 additions and 1 deletions

View File

@ -2348,7 +2348,8 @@ sub match_internal ($$;@) {
sub match_page ($$;@) {
my $page=shift;
my $match=match_glob($page, shift, @_);
if ($match && ! defined IkiWiki::pagetype($IkiWiki::pagesources{$page})) {
if ($match && ! (exists $IkiWiki::pagesources{$page}
&& defined IkiWiki::pagetype($IkiWiki::pagesources{$page}))) {
return IkiWiki::FailReason->new("$page is not a page");
}
else {

View File

@ -2,6 +2,9 @@ Seen while deleting a blog's calendar pages:
--[[Joey]]
[[done]] -- the new `page()` pagespec needed to check if there was a source
file for the page, and was leaking undef.
<pre>
427250f..ff6c054 master -> origin/master
Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.