Fix:ControllerLinkGeneratorExtensions.GetAmbientValues throws NullReferenceException (#24576)

- related issue #24412
- add null check on GetAmbientValues(HttpContext)
This commit is contained in:
WuYafeng 2020-08-06 00:33:31 +08:00 committed by GitHub
parent f05827484e
commit 748798889b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -256,7 +256,7 @@ namespace Microsoft.AspNetCore.Routing
private static RouteValueDictionary GetAmbientValues(HttpContext httpContext)
{
return httpContext?.Features.Get<IRouteValuesFeature>()?.RouteValues;
return httpContext?.Features?.Get<IRouteValuesFeature>()?.RouteValues;
}
}
}