null entries in value array
Opened this issue · 2 comments
A customer of ours managed to bring the "value" of the property in a state where it was similar to this:
value: [
{id:1234},
null,
{id:1234},
]
So somehow one of the items in the array was null.
This cause two things:
-
The datatype failed, because it tried to access the id property of a null object
-
The frontend failed because the value converter tried ti access properties on a null json object.
I have not been able to reproduce how the null got there in the first place, but it would be nice if the two scenarios above where more null tolerant :)
I fixed the datatype by adding a null check around the building of the renderModel:
if( $scope.model.value ) {
_.each($scope.model.value, function( item, i ) {
if (item !== undefined && item !== null) { //Check for null
$scope.renderModel.push(new Link(item));
if( item.id ) {
(item.isMedia ? mediaIds : documentIds).push( item.id );
}
}
});
}
I think I've seen this where the Back Office is slow to load. They click Save and Publish before the custom property editor has fully loaded and then NULLS are stored. I can't quite remember what site this was on buy I hope this helps... are they on an older Umbraco?
@cheeseytoastie It's a 7.5 install, so not very old.
It's just weird how one of the items is null. Maybe if that item was just a node id, and it uses a async call to populate the value or something.
I've still not been able to reproduce, and it has not happened since.