U4-3081 - Using Checkbox List With No Prevalues Causes Null Reference Exception

Created by Nicholas Westby 09 Oct 2013, 22:55:39 Updated by Sebastiaan Janssen 29 Dec 2013, 13:38:25

I was setting up a site and tried to create a node using a document type that had a property with a data type that had a property editor of "Checkbox list". There were no prevalues on that data type. When I created the new node, I got this error:

Server Error in '/' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

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

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.] umbraco.cms.businesslogic.property.Property..ctor(Property property) +215 umbraco.cms.businesslogic.Content.b__e(Property x) +52 System.Linq.WhereSelectEnumerableIterator2.MoveNext() +145 System.Collections.Generic.List1.InsertRange(Int32 index, IEnumerable1 collection) +454 System.Collections.Generic.List1.AddRange(IEnumerable`1 collection) +10 umbraco.cms.businesslogic.Content.InitializeProperties() +355 umbraco.cms.businesslogic.Content.EnsureProperties() +38 umbraco.cms.businesslogic.Content.get_GenericProperties() +28 Umbraco.Web.Strategies.DataTypes.LegacyUploadFieldWorkaround.DocumentBeforeSave(Document sender, SaveEventArgs e) +77 umbraco.cms.businesslogic.web.Document.FireBeforeSave(SaveEventArgs e) +54 umbraco.cms.businesslogic.web.Document.Save() +106 umbraco.cms.businesslogic.web.Document.MakeNew(String Name, DocumentType dct, User u, Int32 ParentId) +578 umbraco.contentTasks.Save() +153 umbraco.presentation.create.dialogHandler_temp.Create(String NodeType, Int32 TypeId, Int32 NodeId, String Text) +584 umbraco.cms.presentation.create.controls.content.DoCreation() +200 umbraco.cms.presentation.create.controls.content.sbmt_Click(Object sender, EventArgs e) +34 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9552602 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18045

Also got a null reference exception when clicking the newly created content node. I tried this a few times, and eventually tried adding a prevalue to the data type, which resolved the error.

Creating a data type without prevalues should not cause a null reference exception.

Comments

Ismail Mayat 07 Nov 2013, 10:15:10

When creating new datatype if you do not click save then the property editor has not been set.


Ismail Mayat 07 Nov 2013, 12:40:31

Pull request available https://github.com/umbraco/Umbraco-CMS/pull/195


Sebastiaan Janssen 29 Dec 2013, 13:38:25

Fixed in rev 32bc2f1d69d292e1a79466529558013119414c3e


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Very Easy

Category:

Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 6.1.6

Due in version: 6.2.0

Sprint:

Story Points:

Cycle: