From 6b073cda9ed996cec5895eb2d9f0b0fd88e50312 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 5 Sep 2019 00:50:04 +0200 Subject: [PATCH] disable markers without graph Avoid error "Modification of non-creatable array value attempted" trying to access unallocated positions. --- graph | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graph b/graph index b41f0c0..0d9db2e 100755 --- a/graph +++ b/graph @@ -39,7 +39,7 @@ my $size = ($maxval - $minval) && ($opt{width} - $lenval - $len) / ($maxval - $minval); # bar multiplication my @barmark; -if ($opt{markers} // 1) { +if ($opt{markers} // 1 and $size > 0) { sub orderpos { (($order[$_[0]] + $order[$_[0] + .5]) / 2 - $minval) * $size } $barmark[ (sum(@order) / @order - $minval) * $size ] = '='; # average $barmark[ orderpos($#order / 2) ] = '+'; # mean -- 2.30.0