fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-10-31 08:58 am

[dw-free] error on profile page

[commit: http://hg.dwscoalition.org/dw-free/rev/2e7b4fce56db]

http://bugs.dwscoalition.org/show_bug.cgi?id=4021

Make sure that we only add something to the hash if it is indeed a hashref.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/DW/Logic/ProfilePage.pm
--------------------------------------------------------------------------------
diff -r 7c62104f1ef1 -r 2e7b4fce56db cgi-bin/DW/Logic/ProfilePage.pm
--- a/cgi-bin/DW/Logic/ProfilePage.pm	Mon Oct 31 16:25:29 2011 +0800
+++ b/cgi-bin/DW/Logic/ProfilePage.pm	Mon Oct 31 16:56:54 2011 +0800
@@ -446,9 +446,7 @@
             $country_ret = LJ::is_enabled( 'directory' ) ?
                 { url => "$dirurl&loc_cn=$ecountry",
                   text => $countries{ $country } } : $countries{ $country };
-            if ( !$state && !$city ) {
-                $country_ret->{secimg} = $secimg;
-            }
+            $country_ret->{secimg} = $secimg if ! $state && ! $city && ref $country_ret eq "HASHREF";
         }
 
         if ( $state ) {
@@ -462,9 +460,7 @@
             $state_ret = $country && LJ::is_enabled( 'directory' ) ?
                 { url => "$dirurl&loc_cn=$ecountry&loc_st=$estate",
                   text => LJ::ehtml( $state ) } : LJ::ehtml( $state );
-            if ( !$city ) {
-                $state_ret->{secimg} = $secimg;
-            }
+            $state_ret->{secimg} = $secimg if !$city && ref $state_ret eq "HASHREF";
         }
 
         if ( $city ) {
@@ -472,7 +468,7 @@
             $city_ret = $country && LJ::is_enabled( 'directory' ) ?
                 { url => "$dirurl&loc_cn=$ecountry&loc_st=$estate&loc_ci=$ecity",
                   text => $city } : $city;
-            $city_ret->{secimg} = $secimg;
+            $city_ret->{secimg} = $secimg if ref $city_ret eq "HASHREF";
         }
 
         push @$ret, $city_ret, $state_ret, $country_ret;
--------------------------------------------------------------------------------