refactor: Adding validation to StringUtils.Repeat

This commit is contained in:
Chris Cameron
2018-10-08 14:53:43 -04:00
parent 381355beb9
commit 8a260e0475

View File

@@ -423,7 +423,12 @@ namespace ICD.Common.Utils
[PublicAPI]
public static string Repeat(string input, int count)
{
return count == 0 ? string.Empty : new StringBuilder().Insert(0, input, count).ToString();
if (count < 0)
throw new ArgumentOutOfRangeException("count");
return input == null || count == 0
? string.Empty
: new StringBuilder().Insert(0, input, count).ToString();
}
/// <summary>