From 979ec28165bcf1c0d04de4398069d5df9a0d70ed Mon Sep 17 00:00:00 2001 From: Robin Krom Date: Tue, 22 Sep 2015 13:21:01 +0200 Subject: [PATCH] Ignore FormatException when decrypting and it wasn't encrypted. --- .../Converters/StringEncryptionTypeConverter.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Dapplo.Config/Converters/StringEncryptionTypeConverter.cs b/Dapplo.Config/Converters/StringEncryptionTypeConverter.cs index 4a31e9d..8999151 100644 --- a/Dapplo.Config/Converters/StringEncryptionTypeConverter.cs +++ b/Dapplo.Config/Converters/StringEncryptionTypeConverter.cs @@ -171,7 +171,14 @@ public override object ConvertFrom(ITypeDescriptorContext context, System.Global string valueString = value as string; if (!string.IsNullOrWhiteSpace(valueString)) { - return Decrypt(valueString); + // Try to decrypt, ignore FormatException + try + { + return Decrypt(valueString); + } catch (FormatException) + { + return valueString; + } } if (valueString != null) {