umbraco/Umbraco.Headless.Client.Net

ModelConverter.ReadJson throws exception on empty Media property (possible others) solution added

Opened this issue · 1 comments

var obj = serializer.Deserialize(reader);

obj becomes null and following throws exception
var contentTypeAlias = obj.GetValue(_aliasProperty).Value();

possible solution
after
var obj = serializer.Deserialize(reader);
put this
if(obj == null) return null;

To replicate create a model with:
public Media SomeImage { get; set; }

Leave it empty in umbraco heartcore and try to retreive it. It will throw an exception. This was not the case earlier.