From: Mischa POSLAWSKY Date: Wed, 4 Sep 2019 22:50:04 +0000 (+0200) Subject: disable markers without graph X-Git-Tag: v1.01~3 X-Git-Url: http://git.shiar.nl/barcat.git/commitdiff_plain/6b073cda9ed996cec5895eb2d9f0b0fd88e50312 disable markers without graph Avoid error "Modification of non-creatable array value attempted" trying to access unallocated positions. --- 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