From d3446049d36fd7b02dde0f5200e77a84ec814ed2 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Fri, 23 Aug 2002 02:11:38 +0000 Subject: [PATCH] Fixed a bug where having poll with no answers would cause the poll wobject to crash. Fixed a bug where the reset votes option in the poll would become mangled if the anti-caching mechanism was enabled. --- lib/WebGUI/Utility.pm | 10 ++++++---- lib/WebGUI/Wobject/Poll.pm | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/WebGUI/Utility.pm b/lib/WebGUI/Utility.pm index 66c6ed488..6f8f81148 100644 --- a/lib/WebGUI/Utility.pm +++ b/lib/WebGUI/Utility.pm @@ -58,10 +58,12 @@ sub randint { sub randomizeArray { my ($array, $i, $j); $array = shift; - for ($i = @$array; --$i; ) { - $j = int rand ($i+1); - next if $i == $j; - @$array[$i,$j] = @$array[$j,$i]; + if ($#$array > 0) { + for ($i = @$array; --$i; ) { + $j = int rand ($i+1); + next if $i == $j; + @$array[$i,$j] = @$array[$j,$i]; + } } } diff --git a/lib/WebGUI/Wobject/Poll.pm b/lib/WebGUI/Wobject/Poll.pm index ec38230b3..e16c6d3df 100644 --- a/lib/WebGUI/Wobject/Poll.pm +++ b/lib/WebGUI/Wobject/Poll.pm @@ -134,7 +134,7 @@ sub www_edit { $output .= $_[0]->SUPER::www_edit($f->printRowsOnly); if ($_[0]->get("wobjectId") ne "new") { $output .= '

'; - $output .= '') + $output .= '' .WebGUI::International::get(10,$namespace).''; } return $output;