This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [perl #24398] Benchmark.pm cmpthese segfault
authorStas Bekman <stas@stason.org>
Wed, 5 Nov 2003 00:50:25 +0000 (16:50 -0800)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Wed, 5 Nov 2003 20:38:09 +0000 (20:38 +0000)
Message-ID: <3FA8B9D1.2020806@stason.org>

p4raw-id: //depot/perl@21671

lib/Benchmark.pm

index c472d58..6129828 100644 (file)
@@ -890,7 +890,7 @@ sub cmpthese{
     @vals = sort { $a->[7] <=> $b->[7] } @vals;
 
     # If more than half of the rates are greater than one...
-    my $display_as_rate = $vals[$#vals>>1]->[7] > 1;
+    my $display_as_rate = @vals ? ($vals[$#vals>>1]->[7] > 1) : 0;
 
     my @rows;
     my @col_widths;