X-Git-Url: https://projects.mako.cc/source/rubyvote/blobdiff_plain/60344b51d7e6c505492183b79b96b76216c95072..1217d8139176963d7c2693e76c0da7910631d9fa:/lib/rubyvote/irv.rb diff --git a/lib/rubyvote/irv.rb b/lib/rubyvote/irv.rb index 3851738..c3fabe6 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=[] + return + end + begin ranked_candidates = votes.sort do |a, b| b[1][0] <=> a[1][0]