From 98b02b1af92e46f6fcd4e0d5e43410b8c6118f5c Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sat, 24 Apr 2021 00:04:12 +0200 Subject: Check for IsNullOrWhiteSpace UnicornFormatWithEnvironment: string.Replace() throws when replace value is null, add IsNullOrWhiteSpace check --- src/IOL.Helpers/StringHelpers.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/IOL.Helpers/StringHelpers.cs') diff --git a/src/IOL.Helpers/StringHelpers.cs b/src/IOL.Helpers/StringHelpers.cs index c090117..3f80d6e 100644 --- a/src/IOL.Helpers/StringHelpers.cs +++ b/src/IOL.Helpers/StringHelpers.cs @@ -32,6 +32,7 @@ namespace IOL.Helpers var matchList = Regex.Matches(input, ""); foreach (var key in matchList.Select(match => match.Value)) { var value = configuration.GetValue(key); + if (string.IsNullOrWhiteSpace(value)) continue; input = input.Replace(key, value); } -- cgit v1.3