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

[dw-free] avoid uninitialized warnings in LJ/Customize.pm

[commit: http://hg.dwscoalition.org/dw-free/rev/81b1241004ea]

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

hush warnings.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/Customize.pm
--------------------------------------------------------------------------------
diff -r ca110e45bf53 -r 81b1241004ea cgi-bin/LJ/Customize.pm
--- a/cgi-bin/LJ/Customize.pm	Fri Dec 10 18:32:06 2010 +0800
+++ b/cgi-bin/LJ/Customize.pm	Fri Dec 10 18:46:56 2010 +0800
@@ -475,8 +475,8 @@ sub save_s2_props {
     $lyr_layout->{'uniq'} = $dbh->selectrow_array("SELECT value FROM s2info WHERE s2lid=? AND infokey=?",
                                               undef, $lyr_layout->{'s2lid'}, "redist_uniq");
 
-    my @grouped_properties = S2::get_properties( $lyr_core->{s2lid} );
-    @grouped_properties = grep { $_->{grouped} == 1 } @grouped_properties;
+    my @grouped_properties = grep { $_->{grouped} && $_->{grouped} == 1 }
+                             S2::get_properties( $lyr_core->{s2lid} );
 
     my %override;
     foreach my $prop ( S2::get_properties( $lyr_layout->{s2lid} ), @grouped_properties )
@@ -496,7 +496,10 @@ sub save_s2_props {
         } else {
             $prop_value = defined $post->{$name} ? $post->{$name} : $prop_values{override};
         }
-        next if $prop_value eq $prop_values{existing};
+        # new and existing match if both defined and same, or both undefined.
+        next if ! defined $prop_value and ! defined $prop_values{existing};
+        next if defined $prop_value and defined $prop_values{existing}
+                and $prop_value eq $prop_values{existing};
         $override{$name} = [ $prop, $prop_value ];
     }
 
--------------------------------------------------------------------------------

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