From 16c39060d72f360ea9a4f9ab5b112e4c9525b2fc Mon Sep 17 00:00:00 2001 From: HarelM Date: Thu, 30 Nov 2023 13:09:27 +0200 Subject: [PATCH] Trim blanks when updating OSM #1956 - Handle null case better --- IsraelHiking.API/Services/Poi/PointsOfInterestProvider.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IsraelHiking.API/Services/Poi/PointsOfInterestProvider.cs b/IsraelHiking.API/Services/Poi/PointsOfInterestProvider.cs index b79c888e8..110484954 100644 --- a/IsraelHiking.API/Services/Poi/PointsOfInterestProvider.cs +++ b/IsraelHiking.API/Services/Poi/PointsOfInterestProvider.cs @@ -209,13 +209,13 @@ private void RemoveEmptyTagsAndWhiteSpaces(TagsCollectionBase tags) for (int i = tags.Count - 1; i >= 0; i--) { var currentTag = tags.ElementAt(i); - var valueWithOutExtraSpaces = Regex.Replace(currentTag.Value, @"\s+", " ", RegexOptions.Multiline).Trim(); - if (string.IsNullOrWhiteSpace(valueWithOutExtraSpaces)) + if (string.IsNullOrWhiteSpace(currentTag.Value)) { tags.RemoveKeyValue(currentTag); } else { + var valueWithOutExtraSpaces = Regex.Replace(currentTag.Value, @"\s+", " ", RegexOptions.Multiline).Trim(); currentTag.Value = valueWithOutExtraSpaces; tags.AddOrReplace(currentTag); }