Fix numeric comparisons with undef

master
Simon McVittie 2014-11-26 11:29:14 +00:00
parent 105f285a63
commit 1abf35e1b5
1 changed files with 8 additions and 0 deletions

View File

@ -221,6 +221,10 @@ sub previousmonth($$$) {
my $month = shift; my $month = shift;
my $archivebase = shift; my $archivebase = shift;
if (not exists $wikistate{calendar}{minyear}) {
$wikistate{calendar}{minyear} = $year;
}
my $pmonth = $month; my $pmonth = $month;
my $pyear = $year; my $pyear = $year;
while ((not exists $pagesources{"$archivebase/$pyear/" . sprintf("%02d", $pmonth)}) or ($pmonth == $month and $pyear == $year)) { while ((not exists $pagesources{"$archivebase/$pyear/" . sprintf("%02d", $pmonth)}) or ($pmonth == $month and $pyear == $year)) {
@ -239,6 +243,10 @@ sub nextmonth($$$) {
my $month = shift; my $month = shift;
my $archivebase = shift; my $archivebase = shift;
if (not exists $wikistate{calendar}{maxyear}) {
$wikistate{calendar}{maxyear} = $year;
}
my $nmonth = $month; my $nmonth = $month;
my $nyear = $year; my $nyear = $year;
while ((not exists $pagesources{"$archivebase/$nyear/" . sprintf("%02d", $nmonth)}) or ($nmonth == $month and $nyear == $year)) { while ((not exists $pagesources{"$archivebase/$nyear/" . sprintf("%02d", $nmonth)}) or ($nmonth == $month and $nyear == $year)) {