mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Fixing possible NRE in when a menu item's content doesn't exist
--HG-- branch : 1.x
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user