Fix:ControllerLinkGeneratorExtensions.GetAmbientValues throws NullReferenceException (#24576)
- related issue #24412 - add null check on GetAmbientValues(HttpContext)
This commit is contained in:
parent
f05827484e
commit
748798889b
|
|
@ -256,7 +256,7 @@ namespace Microsoft.AspNetCore.Routing
|
||||||
|
|
||||||
private static RouteValueDictionary GetAmbientValues(HttpContext httpContext)
|
private static RouteValueDictionary GetAmbientValues(HttpContext httpContext)
|
||||||
{
|
{
|
||||||
return httpContext?.Features.Get<IRouteValuesFeature>()?.RouteValues;
|
return httpContext?.Features?.Get<IRouteValuesFeature>()?.RouteValues;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue