fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2012-04-16 09:37 am

[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 [personal profile] kareila.

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'});
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org