Commit 9b4020bc authored by Sebastien Moretti's avatar Sebastien Moretti
Browse files

Fix fatal error when using undefined hash ref in testBOJ fct

parent fced4bf7
......@@ -1137,11 +1137,12 @@ sub testPositions{
sub testBOJ{
my ($posBOJ, $currentTarget, $bestBOJ) = @_;
my %positBOJ = %$posBOJ;
if (%positBOJ ne 0){
%positBOJ = (%positBOJ, '0' => $currentTarget);
if ( $posBOJ && %$posBOJ ne 0 ){
my %positBOJ = %$posBOJ;
$positBOJ{'0'} = $currentTarget;
my @clefs = sort({$a <=> $b} keys(%positBOJ));
while(my ($x, $y) =each(%positBOJ) ){
while(my ($x, $y) = each(%positBOJ) ){
print "pos:$x -> $y\n" if ( $debug && $x>0 );
}
......@@ -1154,11 +1155,11 @@ sub testBOJ{
return($bestBOJ) if ( exists($cles[0]) && $#cles >= $#clefs );
}
}
elsif ( %$bestBOJ ne 0 ){
elsif ( $bestBOJ && %$bestBOJ ne 0 ){
return($bestBOJ);
}
else {
return(\%positBOJ);
return($posBOJ);
}
}
########################################################
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment