UrlHelperFactory.GetUrlHelper throws NullReferenceException when passed
a null action context. This change validates the action context parameter.
This commit is contained in:
parent
3517ecda2f
commit
42dcd0ba28
|
|
@ -15,6 +15,11 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
|||
/// <inheritdoc />
|
||||
public IUrlHelper GetUrlHelper(ActionContext context)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(Resources.ArgumentCannotBeNullOrEmpty, (nameof(context)));
|
||||
}
|
||||
|
||||
var httpContext = context.HttpContext;
|
||||
|
||||
if (httpContext == null)
|
||||
|
|
|
|||
Loading…
Reference in New Issue