Skip to content

Commit cf7ccfa

Browse files
authored
Apply suggestion from @niemyjski
1 parent 313d25f commit cf7ccfa

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Exceptionless.DateTimeExtensions/TimeUnit.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ public static bool TryParse(string value, out TimeSpan? time)
2828

2929
private static TimeSpan? ParseTime(string value)
3030
{
31-
if (String.IsNullOrEmpty(value))
31+
if (String.IsNullOrWhitespace(value))
3232
return null;
3333

3434
string normalized = value.Trim();
35-
if (String.IsNullOrEmpty(normalized))
36-
return null;
3735

38-
// bail if we have any weird characters
39-
foreach (char c in value)
36+
// bail if we have any weird characters
37+
foreach (char c in normalized)
4038
if (!Char.IsLetterOrDigit(c) && c != '-' && c != '+' && !Char.IsWhiteSpace(c))
4139
return null;
4240

0 commit comments

Comments
 (0)