[aur-dev] [PATCH v2] tu_details.php: Avoid division by zero
Lukas Fleischer
archlinux at cryptocrack.de
Mon Aug 26 12:03:14 EDT 2013
Do not divide by zero if the number of active TUs is unknown.
Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
---
web/template/tu_details.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/web/template/tu_details.php b/web/template/tu_details.php
index c09e30c..c546eb7 100644
--- a/web/template/tu_details.php
+++ b/web/template/tu_details.php
@@ -6,7 +6,11 @@ $active_tus = $row["ActiveTUs"];
$quorum = $row["Quorum"];
$total = $yes + $no + $abstain;
-$participation = $total / $active_tus;
+if ($active_tus > 0) {
+ $participation = $total / $active_tus;
+} else {
+ $participation = 0;
+}
if ($yes > $active_tus / 2) {
$vote_accepted = true;
--
1.8.4.rc3.500.gc3113b0
More information about the aur-dev
mailing list