BUG: NullException using TypedCrops with DAMP.PropertyEditorValueConverter.Model
Hello,
I've just had 'one of those' bugs which took a seemingly long time to track down exactly what was causing it - but now it's all clear - so I thought I'd post up the details so that a fix could maybe be added to the source.
If you have a media item - with the Image cropper - and you have, for instance two properties on this media item:
Image - (File Upload)
Crop - (Image Cropper)
In Razor when you use the DAMP_Item model - and you try to access TypedCrops (TypedCrops.Count) for instance - you will get a null reference exception!
I evenutally took a look at the source and found my property name of "crop" to be at fault - this line of code in TypedCrops will pickup the empty '<crop>' tag - which doesn't contain any attributes - and so the unhandled exception occurs:
My solution was to change the Umbraco property name to something other than crop - in essence it's a reserved word - a better solution would be handle gracefuly the occurance of <crop> tags which don't contain actual crop attributes..
Here's a snippet of the original xml that caused the troubles:
BUG: NullException using TypedCrops with DAMP.PropertyEditorValueConverter.Model
Hello,
I've just had 'one of those' bugs which took a seemingly long time to track down exactly what was causing it - but now it's all clear - so I thought I'd post up the details so that a fix could maybe be added to the source.
If you have a media item - with the Image cropper - and you have, for instance two properties on this media item:
I'll see if I can fix this for the next version. For now just don't name the ImageCropper on your Media Type 'crop'.
Jeroen
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.