Account for null Endpoint

This commit is contained in:
Pranav K 2019-01-25 13:47:07 -08:00 committed by Artak
parent f2ee3201ae
commit 1aa50faa29
1 changed files with 1 additions and 1 deletions

View File

@ -47,7 +47,7 @@ namespace Microsoft.AspNetCore.Authorization
var endpoint = context.GetEndpoint();
// Workaround for https://github.com/aspnet/AspNetCore/issues/7011. Do not use the AuthorizationMiddleware for Razor Pages
if (endpoint.Metadata.Any(m => m.GetType().FullName == "Microsoft.AspNetCore.Mvc.ApplicationModels.PageRouteMetadata"))
if (endpoint != null && endpoint.Metadata.Any(m => m.GetType().FullName == "Microsoft.AspNetCore.Mvc.ApplicationModels.PageRouteMetadata"))
{
await _next(context);
return;