diff --git a/src/Umbraco.Web/DefaultPublishedMediaStore.cs b/src/Umbraco.Web/DefaultPublishedMediaStore.cs
index 79eed8ef72..4b0909936f 100644
--- a/src/Umbraco.Web/DefaultPublishedMediaStore.cs
+++ b/src/Umbraco.Web/DefaultPublishedMediaStore.cs
@@ -125,6 +125,20 @@ namespace Umbraco.Web
if (media != null && media.Current != null)
{
media.MoveNext();
+ var moved = media.Current.MoveToFirstChild();
+ //first check if we have an error
+ if (moved)
+ {
+ if (media.Current.Name.InvariantEquals("error"))
+ {
+ return null;
+ }
+ }
+ if (moved)
+ {
+ //move back to the parent and return
+ media.Current.MoveToParent();
+ }
return ConvertFromXPathNavigator(media.Current);
}
diff --git a/src/Umbraco.Web/Mvc/RenderMvcController.cs b/src/Umbraco.Web/Mvc/RenderMvcController.cs
index 08469ef9ff..9a7d0a4f64 100644
--- a/src/Umbraco.Web/Mvc/RenderMvcController.cs
+++ b/src/Umbraco.Web/Mvc/RenderMvcController.cs
@@ -61,20 +61,33 @@ namespace Umbraco.Web.Mvc
}
///
- /// The default action to render the front-end view
+ /// Returns an ActionResult based on the template name found in the route values and the given model.
///
+ ///
///
///
- public virtual ActionResult Index(RenderModel model)
+ ///
+ /// If the template found in the route values doesn't physically exist, then an empty ContentResult will be returned.
+ ///
+ protected ActionResult CurrentTemplate(T model)
{
var template = ControllerContext.RouteData.Values["action"].ToString();
if (!EnsurePhsyicalViewExists(template))
{
return Content("");
}
-
return View(template, model);
}
+ ///
+ /// The default action to render the front-end view
+ ///
+ ///
+ ///
+ public virtual ActionResult Index(RenderModel model)
+ {
+ return CurrentTemplate(model);
+ }
+
}
}
\ No newline at end of file