Skip to content
This repository has been archived by the owner on Dec 24, 2022. It is now read-only.

Commit

Permalink
Guard HasAnyEscapeChars() against empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Jan 23, 2019
1 parent 3b98719 commit 36313cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ServiceStack.Text/CsvWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ public static class CsvWriter
{
public static bool HasAnyEscapeChars(string value)
{
return CsvConfig.EscapeStrings.Any(value.Contains)
|| value[0] == JsWriter.ListStartChar
|| value[0] == JsWriter.MapStartChar;
return !string.IsNullOrEmpty(value)
&& (CsvConfig.EscapeStrings.Any(value.Contains)
|| value[0] == JsWriter.ListStartChar
|| value[0] == JsWriter.MapStartChar);
}

internal static void WriteItemSeperatorIfRanOnce(TextWriter writer, ref bool ranOnce)
Expand Down

0 comments on commit 36313cf

Please sign in to comment.