Skip to content

Commit

Permalink
Trim blanks when updating OSM #1956 - Handle null case better
Browse files Browse the repository at this point in the history
  • Loading branch information
HarelM committed Nov 30, 2023
1 parent 6d2b74e commit 16c3906
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions IsraelHiking.API/Services/Poi/PointsOfInterestProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 16c3906

Please sign in to comment.