Skip to content

Commit a00190b

Browse files
authored
Merge pull request #247 from manuelm/gh246
Sorting tree: Check if the key exists. Do not care about its value.
2 parents 3f14398 + 1326f2b commit a00190b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

wwwroot/cgi-bin/awstats.pl

+3-3
Original file line numberDiff line numberDiff line change
@@ -8481,7 +8481,7 @@ sub AddInTree {
84818481
}
84828482
return;
84838483
}
8484-
if ( $val{$keyval} ) { # Val is already in tree
8484+
if ( exists($val{$keyval}) ) { # Val is already in tree
84858485
if ($Debug) { debug( " val is already in tree", 4 ); }
84868486
$egal{$keytoadd} = $val{$keyval};
84878487
$val{$keyval} = $keytoadd;
@@ -8528,7 +8528,7 @@ sub AddInTree {
85288528
while ( $nextval{$valcursor} && ( $nextval{$valcursor} < $keyval ) ) {
85298529
$valcursor = $nextval{$valcursor};
85308530
}
8531-
if ( $nextval{$valcursor} )
8531+
if ( exists($nextval{$valcursor}) )
85328532
{ # keyval is between valcursor and nextval{valcursor}
85338533
$nextval{$keyval} = $nextval{$valcursor};
85348534
}
@@ -8556,7 +8556,7 @@ sub Removelowerval {
85568556
if ($Debug) {
85578557
debug( " remove for lowerval=$lowerval: key=$keytoremove", 4 );
85588558
}
8559-
if ( $egal{$keytoremove} ) {
8559+
if ( exists($egal{$keytoremove}) ) {
85608560
$val{$lowerval} = $egal{$keytoremove};
85618561
delete $egal{$keytoremove};
85628562
}

0 commit comments

Comments
 (0)