callumbwhyte / super-value-converters

A collection of powerful property value converters for cleaner code in Umbraco
MIT License
14 stars 12 forks source link

Prevent possible NullReferenceException #14

Closed rbottema closed 3 years ago

rbottema commented 4 years ago

In some cases, the prevalues of the datatype may not contain the AllowedDoctypes key, resulting in settings.AllowedDoctypes to be null. This in turn, caused the entire website to be broken for me due to the NullReferenceException being thrown. Saving the DataType causes the prevalues to be there as expected, but I believe the library should not break the site.

This quickfix solves this issue. Another possibility is making sure that settings.AllowedDoctypes is initialized as an empty array by default, but I'll leave that decision up to you.

callumbwhyte commented 3 years ago

Hey @rbottema,

Thanks for this PR - sorry it's been open a while, somehow slipped through the net...

Meanwhile this was already fixed in the V7 branch and is coming in the next release!

Cheers, Callum