photo-stats

statistics processor for the terminal
git clone https://git.clttr.info/photo-stats.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit b0c20cbd65ef2587ffca943262a27a741f245810
parent 3890061aef93931a65e524130735b657c658461e
Author: René Wagner <rwagner@rw-net.de>
Date:   Sun, 30 Aug 2020 16:14:01 +0200

fix "division by 0" on empty result set

Diffstat:
Mphosta.pl | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/phosta.pl b/phosta.pl @@ -279,7 +279,7 @@ sub result_to_stdout } foreach (@$rows) { - my $perc = sprintf("%.1f", (@$_[$#$_] / $sum)* 100). '%'; + my $perc = $sum > 0 ? sprintf("%.1f", (@$_[$#$_] / $sum)* 100). '%' : ''; push @$_, $perc; }