Moving check to TryToConvertValueToCrlType

This commit is contained in:
Robert
2018-02-08 13:15:43 +01:00
parent 84265a9716
commit 151c35bc47

View File

@@ -176,6 +176,12 @@ namespace Umbraco.Core.PropertyEditors
/// <returns></returns>
internal Attempt<object> TryConvertValueToCrlType(object value)
{
var jv = value as JValue;
if (jv != null)
{
value = value.ToString();
}
//this is a custom check to avoid any errors, if it's a string and it's empty just make it null
var s = value as string;
if (s != null)
@@ -248,7 +254,7 @@ namespace Umbraco.Core.PropertyEditors
return null;
}
var result = TryConvertValueToCrlType((editorValue.Value != null && editorValue.Value.GetType() == typeof(JValue)) ? editorValue.Value.ToString() : editorValue.Value);
var result = TryConvertValueToCrlType(editorValue.Value);
if (result.Success == false)
{
LogHelper.Warn<PropertyValueEditor>("The value " + editorValue.Value + " cannot be converted to the type " + GetDatabaseType());