From 1abf35e1b5223de4c3da142eda6bf8b036272b34 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 26 Nov 2014 11:29:14 +0000 Subject: [PATCH] Fix numeric comparisons with undef --- IkiWiki/Plugin/calendar.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm index 3d10b1e2e..23246757b 100644 --- a/IkiWiki/Plugin/calendar.pm +++ b/IkiWiki/Plugin/calendar.pm @@ -221,6 +221,10 @@ sub previousmonth($$$) { my $month = shift; my $archivebase = shift; + if (not exists $wikistate{calendar}{minyear}) { + $wikistate{calendar}{minyear} = $year; + } + my $pmonth = $month; my $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 $archivebase = shift; + if (not exists $wikistate{calendar}{maxyear}) { + $wikistate{calendar}{maxyear} = $year; + } + my $nmonth = $month; my $nyear = $year; while ((not exists $pagesources{"$archivebase/$nyear/" . sprintf("%02d", $nmonth)}) or ($nmonth == $month and $nyear == $year)) {