UrlHelperFactory.GetUrlHelper throws NullReferenceException when passed

a null action context.

This change validates the action context parameter.
This commit is contained in:
Rob Ward 2018-03-01 11:25:04 -08:00 committed by Pranav K
parent 3517ecda2f
commit 42dcd0ba28
1 changed files with 5 additions and 0 deletions

View File

@ -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)