Description
Fixed an issue that caused the edit UI to break when you cleared a block in a block list.
Prerequisite
Add block types as following to the site (such as the Alloy sample site):
[ContentType]public class AccordionBlock : BlockData
{{{ public virtual string? Title
{ get; set; } public virtual IList<AccordionItemBlock>? Items { get; set; }}}
}
{{
[ContentType]public class AccordionItemBlock : BlockData{ public virtual string? Title{ get; set; }
}}
{{public virtual string? Subtitle { get; set; } public virtual XhtmlString? Body{ get; set; }}}
}
Steps to reproduce
- Enable inline blocks for the site (UIOptions.InlineBlocksInContentAreaEnabled = true).
- Create a new instance of Accordion Block against a page as an inline block.
- Add three child items into AccordionBlock.Items with each item having values in every property.
- Save the block.
- Save and publish the page.
- Refresh the page.
- Edit the Accordion block.
- Expand the second child item.
- Remove the text from every property within the second child item.
- Save the block, and save and publish the page. At this point you, a null reference exception displays because of the lack of null handling in the aforementioned CMS code.
- Refresh the page in the browser. Note that the page does not load in the browser.
- Check the network settings and see a 500 error response on the API call to get the page data.