Closed ribsdigital closed 3 years ago
Hi @ribsdigital
I will try to have a look at this today.
Dave
Hi @ribsdigital
I tried to reproduce this, but I can't get this error.
Can you show me the code in your view ?
This is what I have
@if(Model.SingleVideo != null)
{
@Model.SingleVideo.EmbedCode
}
Dave
hi @dawoe thanks for getting back to me 👍
i did some more digging and i think i've found the issue. if we use the property in a regular doctype, there's no problem, we can do the null check in an if statement and everything works as expected.
however, we're using your package in conjunction with the https://our.umbraco.com/packages/backoffice-extensions/bento-editor/ package and that's when the exception occurs...
so i downloaded the property editor and dropped it into the project so i could debug - the issue seems to be on this line of the OEmbedPickerValueConverter
property converter class:
if (inter == null)
{
return allowMultipe ? Enumerable.Empty<OEmbedItem>() : null;
}
in a regular doctype, the inter
property returns as null if a video hasn't been picked. but when it goes through bento, it returns as an empty string...
so i changed the code to this and it now works as expected:
if (string.IsNullOrWhiteSpace(inter?.ToString()))
{
return allowMultipe ? Enumerable.Empty<OEmbedItem>() : null;
}
just pushed this up as a pull request ;)
https://github.com/dawoe/OEmbed-Picker-Property-Editor/pull/12
Hi @dawoe I am having the issue as well, any chance to get release a version with the fix? Thank you for the package!
Just released version 4.3.0 that contains this fix
hi @dawoe just installed the newest version of the plugin in a new site - lookin good!
one issue i have ran into though is that if a property is not marked as mandatory the models builder blows up...
this is the doctype set up:
if i select a video, everything works fine - if i leave the property empty, the class generated by the models builder throws the following exception when attempting to view a page that uses the model:
could this be an issue in the OEmbedPickerValueConverter property converter?
cheers,
jake