From 151c35bc4754fc8450ee7f62a413d0a0ddf74e6e Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 8 Feb 2018 13:15:43 +0100 Subject: [PATCH] Moving check to TryToConvertValueToCrlType --- src/Umbraco.Core/PropertyEditors/PropertyValueEditor.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Core/PropertyEditors/PropertyValueEditor.cs b/src/Umbraco.Core/PropertyEditors/PropertyValueEditor.cs index 224dcfa67b..28adeb7663 100644 --- a/src/Umbraco.Core/PropertyEditors/PropertyValueEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/PropertyValueEditor.cs @@ -176,6 +176,12 @@ namespace Umbraco.Core.PropertyEditors /// internal Attempt 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("The value " + editorValue.Value + " cannot be converted to the type " + GetDatabaseType());