Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit 139976e

Browse files
committed
Do not run TryParseExact on null dates
1 parent 6c56f1d commit 139976e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Microsoft.Net.Http.Headers/HttpRuleParser.cs

+5
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,11 @@ internal static string DateToString(DateTimeOffset dateTime)
241241

242242
internal static bool TryStringToDate(string input, out DateTimeOffset result)
243243
{
244+
if (input == null)
245+
{
246+
return false;
247+
}
248+
244249
// Try the various date formats in the order listed above.
245250
// We should accept a wide verity of common formats, but only output RFC 1123 style dates.
246251
if (DateTimeOffset.TryParseExact(input, DateFormats, DateTimeFormatInfo.InvariantInfo,

0 commit comments

Comments
 (0)