From: John Dong Date: Wed, 15 Aug 2007 19:38:02 +0000 (+0000) Subject: Add somewhat hackish fix for PureCondorcetVote.new([]).result deadlocking X-Git-Url: https://projects.mako.cc/source/rubyvote/commitdiff_plain/ebb1c7006d50d8761066bcd5d0e6bbc347b9e0c8?hp=21e8998e39385a5cfd90ef597ccdbd760227baa7 Add somewhat hackish fix for PureCondorcetVote.new([]).result deadlocking git-svn-id: svn://rubyforge.org/var/svn/rubyvote/trunk@33 1440c7f4-e209-0410-9a04-881b5eb134a8 --- diff --git a/lib/rubyvote/condorcet.rb b/lib/rubyvote/condorcet.rb index 65c664d..c0539ab 100644 --- a/lib/rubyvote/condorcet.rb +++ b/lib/rubyvote/condorcet.rb @@ -184,7 +184,10 @@ class PureCondorcetResult < CondorcetResult def condorcet votes = @election.votes candidates = @election.candidates - + unless votes.length>0 and candidates.length>0 + @winners=[nil] + return @winners + end victors = Hash.new candidates.each do |candidate| victors[candidate] = Array.new