vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r15639: Strictly initialize $LJ::CACHED_CATEGORI...

Committer: vsukhanov
Strictly initialize $LJ::CACHED_CATEGORIES_FOR_NAV to avoid "Can't use an undefined value as an ARRAY reference at /home/lj/cgi-bin/LJ/Browse.pm line 341"

U   trunk/cgi-bin/LJ/Browse.pm
Modified: trunk/cgi-bin/LJ/Browse.pm
===================================================================
--- trunk/cgi-bin/LJ/Browse.pm	2009-08-26 09:11:33 UTC (rev 15638)
+++ trunk/cgi-bin/LJ/Browse.pm	2009-08-27 07:24:35 UTC (rev 15639)
@@ -324,12 +324,13 @@
         return @$LJ::CACHED_CATEGORIES_FOR_NAV;
     }
 
-    my @categories;
+    my @categories = ();
     foreach my $cat ($class->load_top_level) {
-        next unless $cat->in_nav;
-        push @categories, $cat if $cat;
+        next unless $cat and $cat->in_nav;
+        push @categories, $cat;
     }
 
+    $LJ::CACHED_CATEGORIES_FOR_NAV = [];
     foreach my $c (sort { $a->in_nav cmp $b->in_nav } @categories) {
         push @$LJ::CACHED_CATEGORIES_FOR_NAV, {
             id => $c->catid,
@@ -337,7 +338,7 @@
             url => $c->url,
         };
     }
-
+    
     return @$LJ::CACHED_CATEGORIES_FOR_NAV;
 }
 

Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments