Fixing possible NRE in when a menu item's content doesn't exist

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-10-24 15:51:07 -07:00
parent 779bb49478
commit d01ff9df75

View File

@@ -27,6 +27,12 @@ namespace Orchard.Core.Navigation.Handlers {
var contentMenuItemPart = context.ContentItem.As<ContentMenuItemPart>();
// the display route for the menu item is the one for the referenced content item
if(contentMenuItemPart != null) {
// if the content doesn't exist anymore
if(contentMenuItemPart.Content == null) {
return;
}
context.Metadata.DisplayRouteValues = _contentManager.GetItemMetadata(contentMenuItemPart.Content).DisplayRouteValues;
}
}