Added double check for the decimal label

This commit is contained in:
Michael Pontin
2019-09-06 17:39:57 +01:00
committed by Sebastiaan Janssen
parent e83760c6bd
commit 1c9ed847a1

View File

@@ -65,6 +65,8 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
if (source is decimal sourceDecimal) return sourceDecimal;
if (source is string sourceDecimalString)
return decimal.TryParse(sourceDecimalString, NumberStyles.Any, CultureInfo.InvariantCulture, out var d) ? d : 0;
if (source is double sourceDouble)
return Convert.ToDecimal(sourceDouble);
return (decimal) 0;
case ValueTypes.Integer:
if (source is int sourceInt) return sourceInt;