Skip to content

Commit

Permalink
Added null check for CurrentHttpContext
Browse files Browse the repository at this point in the history
  • Loading branch information
mmooney committed Dec 28, 2012
1 parent 8674d98 commit 1747fa0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Mvc.Mailer/MailerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ public virtual LinkedResource PopulateLinkedResource(AlternateView mailPart, str
}

private void CreateControllerContext() {
var routeData = RouteTable.Routes.GetRouteData(CurrentHttpContext);
if (CurrentHttpContext == null) {
throw new ArgumentNullException("CurrentHttpContext", "CurrentHttpContext cannot be null");
}
var routeData = RouteTable.Routes.GetRouteData(CurrentHttpContext);
ControllerContext = new ControllerContext(CurrentHttpContext, routeData, this);
}

Expand Down

0 comments on commit 1747fa0

Please sign in to comment.