From ac39d41053169e5199c2e807df80129ea96039db Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Thu, 18 Sep 2003 13:50:45 +0000
Subject: [PATCH] - Fix for bug #2733: devision by zero.  Patch by Jonathan.

---
 modules/poll.module      | 2 +-
 modules/poll/poll.module | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/poll.module b/modules/poll.module
index bdf7a2ea1235..79a1a9704b8a 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 bdf7a2ea1235..79a1a9704b8a 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\">";
-- 
GitLab