Skip to content
Browse files

Added AcceptTypes null check to PartialViewResultFormatter.

  • Loading branch information...
1 parent c8184d8 commit 0d5e04cf3276d760df4488de74b4065cdc5142a0 @benfoster committed Mar 6, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/Fabrik.Common.Web/PartialViewResultFormatter.cs
View
4 src/Fabrik.Common.Web/PartialViewResultFormatter.cs
@@ -18,7 +18,9 @@ public PartialViewResultFormatter(string partialViewPrefix = "_", string viewOve
public virtual bool IsSatisfiedBy(ControllerContext controllerContext)
{
- return controllerContext.HttpContext.Request.AcceptTypes.Contains("text/html")
+ var acceptTypes = controllerContext.HttpContext.Request.AcceptTypes ?? new string[0];
+
+ return acceptTypes.Contains("text/html")
&& (controllerContext.HttpContext.Request.IsAjaxRequest() || controllerContext.IsChildAction);
}

0 comments on commit 0d5e04c

Please sign in to comment.
Something went wrong with that request. Please try again.