[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
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3330
hush warnings.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
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 ]; } --------------------------------------------------------------------------------