From d676bbc3498c007017753bc978448bf2ddd5dc29 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 7 May 2015 11:06:42 +1000 Subject: [PATCH] handle invalid param gracefully --- app/models/incoming_link.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/incoming_link.rb b/app/models/incoming_link.rb index 9064b0d0d..fd3e9e8e8 100644 --- a/app/models/incoming_link.rb +++ b/app/models/incoming_link.rb @@ -14,7 +14,9 @@ class IncomingLink < ActiveRecord::Base user_id, host, referer = nil current_user = opts[:current_user] - if username = opts[:username] + username = opts[:username] + username = nil unless String === username + if username u = User.select(:id).find_by(username_lower: username.downcase) user_id = u.id if u end