Skip to content

Commit

Permalink
Merge pull request stefanprodan#16 from nicholashead/patch-1
Browse files Browse the repository at this point in the history
Add null check for requestIdentity.UserAgent
  • Loading branch information
stefanprodan authored Feb 25, 2017
2 parents 71b51e1 + 6ebb0fd commit 0942b36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion MvcThrottle/ThrottlingFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ private bool IsWhitelisted(RequestIdentity requestIdentity)
Policy.EndpointWhitelist.Any(x => requestIdentity.Endpoint.IndexOf(x, 0, StringComparison.InvariantCultureIgnoreCase) != -1))
return true;

if (Policy.UserAgentThrottling)
if (Policy.UserAgentThrottling && requestIdentity.UserAgent != null)
if (Policy.UserAgentWhitelist != null &&
Policy.UserAgentWhitelist.Any(x => requestIdentity.UserAgent.IndexOf(x, 0, StringComparison.InvariantCultureIgnoreCase) != -1))
return true;
Expand Down

0 comments on commit 0942b36

Please sign in to comment.