From: Stas Bekman <stas@stason.org>
Date: Wed, 5 Nov 2003 00:50:25 +0000 (-0800)
Subject: Re: [perl #24398] Benchmark.pm cmpthese segfault
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d598cef23bd608fe31ab6055c3ab087b1e23920e;p=p5sagit%2Fp5-mst-13.2.git

Re: [perl #24398] Benchmark.pm cmpthese segfault
Message-ID: <3FA8B9D1.2020806@stason.org>

p4raw-id: //depot/perl@21671
---

diff --git a/lib/Benchmark.pm b/lib/Benchmark.pm
index c472d58..6129828 100644
--- a/lib/Benchmark.pm
+++ b/lib/Benchmark.pm
@@ -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;