From 6633b92d5f4d14416713152f46d2e0f8caa0a943 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Wed, 13 Apr 2016 19:46:03 +0530 Subject: [PATCH] FIX: do not raise exception if user not found while rate limiting --- lib/rate_limiter/on_create_record.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rate_limiter/on_create_record.rb b/lib/rate_limiter/on_create_record.rb index a9a0d7ed285..4232ab9a7f8 100644 --- a/lib/rate_limiter/on_create_record.rb +++ b/lib/rate_limiter/on_create_record.rb @@ -13,7 +13,7 @@ class RateLimiter return @rate_limiter if @rate_limiter.present? limit_key = "create_#{self.class.name.underscore}" - max_setting = if user.new_user? and SiteSetting.has_setting?("rate_limit_new_user_#{limit_key}") + max_setting = if user && user.new_user? and SiteSetting.has_setting?("rate_limit_new_user_#{limit_key}") SiteSetting.send("rate_limit_new_user_#{limit_key}") else SiteSetting.send("rate_limit_#{limit_key}")