#19714: Fixing possible NRE in MenuItemLink shape

Work Item: 19714

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2013-05-20 16:22:04 -07:00
parent 2727da22c9
commit 633bed1677

View File

@@ -104,9 +104,11 @@ namespace Orchard.Core.Shapes {
var menu = menuItem.Menu;
menuItem.Metadata.Alternates.Add("MenuItemLink__" + EncodeAlternateElement(menu.MenuName));
var contentType = ((IContent)menuItem.Content).ContentItem.ContentType;
if(contentType != null) {
menuItem.Metadata.Alternates.Add("MenuItemLink__" + contentType);
if (menuItem.Content != null) {
var contentType = ((IContent) menuItem.Content).ContentItem.ContentType;
if (contentType != null) {
menuItem.Metadata.Alternates.Add("MenuItemLink__" + contentType);
}
}
});