diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-09-18 13:50:45 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-09-18 13:50:45 +0000 |
commit | ac39d41053169e5199c2e807df80129ea96039db (patch) | |
tree | c4106e0c6fb46e9b2e6f12be03e2fb0e74bb8f1a /modules | |
parent | 18312ed8e7e1e025ddf50340740421e00478150e (diff) | |
download | brdo-ac39d41053169e5199c2e807df80129ea96039db.tar.gz brdo-ac39d41053169e5199c2e807df80129ea96039db.tar.bz2 |
- Fix for bug #2733: devision by zero. Patch by Jonathan.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/poll.module | 2 | ||||
-rw-r--r-- | modules/poll/poll.module | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/modules/poll.module b/modules/poll.module index bdf7a2ea1..79a1a9704 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -293,7 +293,7 @@ function poll_view_results(&$node, $main, $block, $links) { if ($node->choice) { foreach ($node->choice as $key => $value) { if ($value != "") { - $width = round($node->chvotes[$key] * 100 / $votestotal); + $width = round($node->chvotes[$key] * 100 / max($votestotal, 1)); $percentage = round($node->chvotes[$key] * 100 / max($votestotal, 1)); $output .= "<div class=\"text\">". filter($value) ."</div>"; $output .= "<div class=\"bar\">"; diff --git a/modules/poll/poll.module b/modules/poll/poll.module index bdf7a2ea1..79a1a9704 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -293,7 +293,7 @@ function poll_view_results(&$node, $main, $block, $links) { if ($node->choice) { foreach ($node->choice as $key => $value) { if ($value != "") { - $width = round($node->chvotes[$key] * 100 / $votestotal); + $width = round($node->chvotes[$key] * 100 / max($votestotal, 1)); $percentage = round($node->chvotes[$key] * 100 / max($votestotal, 1)); $output .= "<div class=\"text\">". filter($value) ."</div>"; $output .= "<div class=\"bar\">"; |