diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-07-31 08:48:49 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-08-04 00:26:03 -0700 |
commit | b7da721f02638083cc3debfd9ae7221d76a96b26 (patch) | |
tree | 4fceff12b82da8b8ac41cc08ac849244ddd77366 /gitweb/gitweb.perl | |
parent | 6639ffc2e026b34b906854b8c60bd72d4b95e78d (diff) | |
download | git-b7da721f02638083cc3debfd9ae7221d76a96b26.tar.gz |
gitweb: fix 'Use of uninitialized value' error in href()
Equality between file_parent and file_name was being checked without a
preliminary check for existence of the parameters.
Fix by wrapping the equality check in appropriate if (defined ...),
rearranging the lines to prevent excessive length.
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb/gitweb.perl')
-rwxr-xr-x | gitweb/gitweb.perl | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 7fbd5ff89e..37120a3e60 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -940,10 +940,13 @@ sub href { if (defined $params{'hash_parent_base'}) { $href .= esc_url($params{'hash_parent_base'}); # skip the file_parent if it's the same as the file_name - delete $params{'file_parent'} if $params{'file_parent'} eq $params{'file_name'}; - if (defined $params{'file_parent'} && $params{'file_parent'} !~ /\.\./) { - $href .= ":/".esc_url($params{'file_parent'}); - delete $params{'file_parent'}; + if (defined $params{'file_parent'}) { + if (defined $params{'file_name'} && $params{'file_parent'} eq $params{'file_name'}) { + delete $params{'file_parent'}; + } elsif ($params{'file_parent'} !~ /\.\./) { + $href .= ":/".esc_url($params{'file_parent'}); + delete $params{'file_parent'}; + } } $href .= ".."; delete $params{'hash_parent'}; |