]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
Sorting tree: Check if the key exists. Do not care about its value. 247/head
authorManuel Mausz <manuel@mausz.at>
Thu, 22 Feb 2024 09:41:00 +0000 (10:41 +0100)
committerManuel Mausz <manuel@mausz.at>
Thu, 22 Feb 2024 09:41:00 +0000 (10:41 +0100)
Fixes eldy/AWStats#246

wwwroot/cgi-bin/awstats.pl

index 649fbd7832049a59ded72d536a340dd96578a61e..879936a5a8c3c31ea84389e56d974b8ef40061f8 100755 (executable)
@@ -8472,7 +8472,7 @@ sub AddInTree {
                }
                return;
        }
-       if ( $val{$keyval} ) {    # Val is already in tree
+       if ( exists($val{$keyval}) ) {    # Val is already in tree
                if ($Debug) { debug( "  val is already in tree", 4 ); }
                $egal{$keytoadd} = $val{$keyval};
                $val{$keyval}    = $keytoadd;
@@ -8519,7 +8519,7 @@ sub AddInTree {
        while ( $nextval{$valcursor} && ( $nextval{$valcursor} < $keyval ) ) {
                $valcursor = $nextval{$valcursor};
        }
-       if ( $nextval{$valcursor} )
+       if ( exists($nextval{$valcursor}) )
        {    # keyval is between valcursor and nextval{valcursor}
                $nextval{$keyval} = $nextval{$valcursor};
        }
@@ -8547,7 +8547,7 @@ sub Removelowerval {
        if ($Debug) {
                debug( "   remove for lowerval=$lowerval: key=$keytoremove", 4 );
        }
-       if ( $egal{$keytoremove} ) {
+       if ( exists($egal{$keytoremove}) ) {
                $val{$lowerval} = $egal{$keytoremove};
                delete $egal{$keytoremove};
        }