[dw-free] uninitialized warnings when viewing journal archive
[commit: http://hg.dwscoalition.org/dw-free/rev/756e8bd5c23e]
http://bugs.dwscoalition.org/show_bug.cgi?id=4410
Initialize variables in some cases: if no entries exist, then fall back onto
the current year when viewing archives. Also, initialize displayed_index.
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=4410
Initialize variables in some cases: if no entries exist, then fall back onto
the current year when viewing archives. Also, initialize displayed_index.
Patch by
Files modified:
- cgi-bin/LJ/S2/YearPage.pm
--------------------------------------------------------------------------------
diff -r 08da827f07dd -r 756e8bd5c23e cgi-bin/LJ/S2/YearPage.pm
--- a/cgi-bin/LJ/S2/YearPage.pm Mon Apr 16 17:36:34 2012 +0800
+++ b/cgi-bin/LJ/S2/YearPage.pm Mon Apr 16 17:39:48 2012 +0800
@@ -53,12 +53,16 @@
# all entries are in the future, so fall back to the earliest year
$year = $years[0]
unless $year;
+
+ # if still undefined, no entries exist - use the current year
+ $year = $curyear
+ unless $year;
}
$p->{'year'} = $year;
$p->{'years'} = [];
- my $displayed_index;
+ my $displayed_index = 0;
for my $i ( 0..$#years ) {
my $year = $years[$i];
push @{$p->{'years'}}, YearYear($year, "$p->{'base_url'}/$year/", $year == $p->{'year'});
--------------------------------------------------------------------------------
