Skip to content
Snippets Groups Projects
Commit ac39d410 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Fix for bug #2733: devision by zero.  Patch by Jonathan.
parent 18312ed8
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -293,7 +293,7 @@ function poll_view_results(&$node, $main, $block, $links) { ...@@ -293,7 +293,7 @@ function poll_view_results(&$node, $main, $block, $links) {
if ($node->choice) { if ($node->choice) {
foreach ($node->choice as $key => $value) { foreach ($node->choice as $key => $value) {
if ($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)); $percentage = round($node->chvotes[$key] * 100 / max($votestotal, 1));
$output .= "<div class=\"text\">". filter($value) ."</div>"; $output .= "<div class=\"text\">". filter($value) ."</div>";
$output .= "<div class=\"bar\">"; $output .= "<div class=\"bar\">";
......
...@@ -293,7 +293,7 @@ function poll_view_results(&$node, $main, $block, $links) { ...@@ -293,7 +293,7 @@ function poll_view_results(&$node, $main, $block, $links) {
if ($node->choice) { if ($node->choice) {
foreach ($node->choice as $key => $value) { foreach ($node->choice as $key => $value) {
if ($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)); $percentage = round($node->chvotes[$key] * 100 / max($votestotal, 1));
$output .= "<div class=\"text\">". filter($value) ."</div>"; $output .= "<div class=\"text\">". filter($value) ."</div>";
$output .= "<div class=\"bar\">"; $output .= "<div class=\"bar\">";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment