Image content part

Topics: Customizing Orchard, General, Troubleshooting
Mar 10, 2016 at 4:54 PM
Edited Mar 10, 2016 at 5:20 PM

When I add Image part to my custom content and create content without providing image(btw there is no field for it), I cannot edit or delete content anymore because it fails on creating preview as I understand.

Here the error:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 3: @{
Line 4: ImagePart imagePart = Model.ContentPart;
Line 5: var mediaPart = ((ContentItem)Model.ContentItem).As<MediaPart>();
Line 6: }
Line 7:

Source File: ...\orchard\Modules\Orchard.MediaLibrary\Views\Parts\Image.SummaryAdmin.cshtml Line: 5

I've added Media part to my content and admin page became working. I've added image, it displays in content list(now it is terrible looking) and white square. But when I try to view my content it fails again with the same error.

I assume that I'm acting wrong because I haven't read documentation yet, but as a programmer I assume this is not normal product behavior when every admin action stops engine from working...