Remove extra null checks.

Fixes #3657
This commit is contained in:
Jeffiy 2015-11-27 08:18:53 -05:00 committed by Pranav K
parent 6875ee55d3
commit 8428ec46e1
4 changed files with 0 additions and 50 deletions

View File

@ -14,16 +14,6 @@ namespace Microsoft.AspNet.Mvc.Cors
public void OnProvidersExecuted(ApplicationModelProviderContext context) public void OnProvidersExecuted(ApplicationModelProviderContext context)
{ {
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
if (context == null) if (context == null)
{ {
throw new ArgumentNullException(nameof(context)); throw new ArgumentNullException(nameof(context));
@ -38,16 +28,6 @@ namespace Microsoft.AspNet.Mvc.Cors
throw new ArgumentNullException(nameof(context)); throw new ArgumentNullException(nameof(context));
} }
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
IEnableCorsAttribute enableCors; IEnableCorsAttribute enableCors;
IDisableCorsAttribute disableCors; IDisableCorsAttribute disableCors;

View File

@ -56,16 +56,6 @@ namespace Microsoft.AspNet.Mvc.Cors
throw new ArgumentNullException(nameof(context)); throw new ArgumentNullException(nameof(context));
} }
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
// If this filter is not closest to the action, it is not applicable. // If this filter is not closest to the action, it is not applicable.
if (!IsClosestToAction(context.Filters)) if (!IsClosestToAction(context.Filters))
{ {

View File

@ -41,16 +41,6 @@ namespace Microsoft.AspNet.Mvc.Cors
throw new ArgumentNullException(nameof(serviceProvider)); throw new ArgumentNullException(nameof(serviceProvider));
} }
if (serviceProvider == null)
{
throw new ArgumentNullException(nameof(serviceProvider));
}
if (serviceProvider == null)
{
throw new ArgumentNullException(nameof(serviceProvider));
}
var filter = serviceProvider.GetRequiredService<CorsAuthorizationFilter>(); var filter = serviceProvider.GetRequiredService<CorsAuthorizationFilter>();
filter.PolicyName = _policyName; filter.PolicyName = _policyName;
return filter; return filter;

View File

@ -34,16 +34,6 @@ namespace Microsoft.AspNet.Mvc.Cors
throw new ArgumentNullException(nameof(context)); throw new ArgumentNullException(nameof(context));
} }
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
var accessControlRequestMethod = var accessControlRequestMethod =
context.HttpContext.Request.Headers[CorsConstants.AccessControlRequestMethod]; context.HttpContext.Request.Headers[CorsConstants.AccessControlRequestMethod];
if (string.Equals( if (string.Equals(