This project is read-only.

Creating new content with Menu Relation part crashes backend


I added the module (1.4.1) via the gallery and when I attach the Menu Relation part to my content type and attempt to create a new item I get the following error message:

Object reference not set to an instance of an object.

Line 7: <legend>@T("Show this item on menu(s)")</legend>
Line 8: @if (Model.Menus.Count() > 0) {
Line 9: foreach (var entry in Model.Menus) {
Line 10: <fieldset>

Source File: \Modules\Szmyd.Orchard.Modules.Menu\Views\EditorTemplates\Parts\Menu.RelationPart.cshtml Line: 8

I do have one menu created that displays one "tab" item with two other options in the drop down so I think it is installed properly.


pszmyd wrote Mar 29, 2012 at 8:48 PM

Thanks for the info - will look into it.

pszmyd wrote Mar 30, 2012 at 3:51 AM

Repro'ed it - will provide fix asap.

dbonnell wrote Jul 18, 2012 at 1:45 AM

I just hit the same issue and as the fix has not officially been released yet I thought I would share it here to save others some time.

Below are the two changes from the latest code on the default fork that I pulled in to my 1.4.1 build to fix this issue.

Views\EditorTemplates\Parts\MenuRelationPart.cshtml, line# 8 needs to be changed to:
@if (Model.Menus.Any()) {
Drivers\Menu.RelationPartDriver.cs, line# 46 needs to be changed to:
MenuText = part.ContentItem.ContentManager.GetItemMetadata(part).DisplayText,