Skip to content

Commit

Permalink
fix division by 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeansen committed Apr 22, 2017
1 parent 5974dbd commit eca6309
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
alpha-0.3-24
alpha-0.3-25
6 changes: 3 additions & 3 deletions cdmn
Original file line number Diff line number Diff line change
Expand Up @@ -1248,16 +1248,16 @@ sub on_start {
my $st = shift;
my $total = 0;

my @k = keys %r;
return 1 if scalar @k < 1;

my $bat_ac = ($h eq XR->{label_battery} || $h eq XR->{label_battery_AC});
%r = %{&cdmn::proc::cpu_usages} if $h eq XR->{label_cpu};
%r = %{&cdmn::proc::cpu_temp_usages} if $h eq XR->{label_cpu_temp};
%r = %{&cdmn::proc::memory_usages} if $h eq XR->{label_memory};
%r = %{&cdmn::proc::disk_usages} if $h eq XR->{label_disk};
%r = %{&cdmn::proc::battery_usages} if $bat_ac;

my @k = keys %r;
return 1 if scalar @k < 1;

if ($st) {
$total += $_ foreach values %r;
$total /= scalar @k;
Expand Down

0 comments on commit eca6309

Please sign in to comment.