From 1326f2baacecb7be2c8718a8ae99b47e2f9d74f9 Mon Sep 17 00:00:00 2001 From: Manuel Mausz Date: Thu, 22 Feb 2024 10:41:00 +0100 Subject: [PATCH] Sorting tree: Check if the key exists. Do not care about its value. Fixes eldy/AWStats#246 --- wwwroot/cgi-bin/awstats.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index 649fbd78..879936a5 100755 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -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}; } -- 2.47.2