Skip to content

Commit

Permalink
guard against nil values
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorntrondsen committed Jan 7, 2014
1 parent 41505cf commit c2b5e12
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/rails_exception_handler/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def initialize(env, request, exception, controller)
def parse
@internal_info[:error_class] = @exception.class.to_s
@internal_info[:target_url] = @request.url
@internal_info[:referer_url] = @request.referer || ""
@internal_info[:user_agent] = @request.user_agent || ""
@internal_info[:referer_url] = @request.referer
@internal_info[:user_agent] = @request.user_agent

config = RailsExceptionHandler.configuration
config.request_info_block.call(@external_info, @request) if(config.request_info_block)
Expand Down Expand Up @@ -75,17 +75,17 @@ def filter_anon_404s
end

def filter_user_agent_regxp(regxp)
result = @internal_info[:user_agent].match(regxp)
result = (@internal_info[:user_agent] || "").match(regxp)
result != nil
end

def filter_target_url_regxp(regxp)
result = @internal_info[:target_url].match(regxp)
result = (@internal_info[:target_url] || "").match(regxp)
result != nil
end

def filter_referer_url_regxp(regxp)
result = @internal_info[:referer_url].match(regxp)
result = (@internal_info[:referer_url] || "").match(regxp)
result != nil
end
end

0 comments on commit c2b5e12

Please sign in to comment.