From 9953cb5cdef82f0e44f07dd089fde77ede170712 Mon Sep 17 00:00:00 2001 From: John Dong Date: Wed, 15 Aug 2007 19:53:05 +0000 Subject: [PATCH] Add similar hackish "fix" for IRVL deadlocking on empty vote git-svn-id: svn://rubyforge.org/var/svn/rubyvote/trunk@35 1440c7f4-e209-0410-9a04-881b5eb134a8 --- lib/rubyvote/irv.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/rubyvote/irv.rb b/lib/rubyvote/irv.rb index 3851738..b26b1d1 100644 --- a/lib/rubyvote/irv.rb +++ b/lib/rubyvote/irv.rb @@ -87,6 +87,11 @@ class InstantRunoffResult < ElectionResult apply_retention(votes, votes_sum * params['percent_retention']) end + unless votes.length > 0 + @winners=[nil] + return + end + begin ranked_candidates = votes.sort do |a, b| b[1][0] <=> a[1][0] -- 2.30.2