]> projects.mako.cc - selectricity-live/commitdiff
Fix error when getting a quickvote result of nonexistent ident
authorJohn Dong <jdong@mit.edu>
Mon, 20 Aug 2007 20:05:46 +0000 (16:05 -0400)
committerJohn Dong <jdong@mit.edu>
Mon, 20 Aug 2007 20:05:46 +0000 (16:05 -0400)
app/controllers/quickvote_controller.rb

index 0d9eb7be4c934c2a08640ab78a2c5bb99b34849f..5b3acab79f21998d5897e90cc331b71745c37b8c 100644 (file)
@@ -156,7 +156,11 @@ class QuickvoteController < ApplicationController
   ###############################################################
 
   def results
   ###############################################################
 
   def results
-    @election = QuickVote.ident_to_quickvote(params[:ident])
+    unless @election = QuickVote.ident_to_quickvote(params[:ident])
+      flash[:notice] = "Cannot find quickvote #{params[:ident]}."
+      redirect_to :controller => 'site'
+      return
+    end
     @election.results
     @candidates = {}
     @election.candidates.each {|c| @candidates[c.id] = c}
     @election.results
     @candidates = {}
     @election.candidates.each {|c| @candidates[c.id] = c}

Benjamin Mako Hill || Want to submit a patch?