From f827dd5e069bce392e8776f554a41e97729bef07 Mon Sep 17 00:00:00 2001 From: "Jamie.Rees" Date: Thu, 5 Oct 2017 13:45:04 +0100 Subject: [PATCH] Fixed #1531 --- src/Ombi.Core/Helpers/TvShowRequestBuilder.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Ombi.Core/Helpers/TvShowRequestBuilder.cs b/src/Ombi.Core/Helpers/TvShowRequestBuilder.cs index b86c7bf34..ad8b1ea26 100644 --- a/src/Ombi.Core/Helpers/TvShowRequestBuilder.cs +++ b/src/Ombi.Core/Helpers/TvShowRequestBuilder.cs @@ -99,7 +99,7 @@ namespace Ombi.Core.Helpers new EpisodeRequests { EpisodeNumber = ep.number, - AirDate = DateTime.Parse(ep.airdate), + AirDate = FormatDate(ep.airdate), Title = ep.name, Url = ep.url } @@ -112,7 +112,7 @@ namespace Ombi.Core.Helpers season.Episodes.Add(new EpisodeRequests { EpisodeNumber = ep.number, - AirDate = DateTime.Parse(ep.airdate), + AirDate = FormatDate(ep.airdate), Title = ep.name, Url = ep.url }); @@ -132,7 +132,7 @@ namespace Ombi.Core.Helpers episodesRequests.Add(new EpisodeRequests { EpisodeNumber = ep.number, - AirDate = DateTime.Parse(ep.airdate), + AirDate = FormatDate(ep.airdate), Title = ep.name, Url = ep.url }); @@ -156,7 +156,7 @@ namespace Ombi.Core.Helpers episodesRequests.Add(new EpisodeRequests { EpisodeNumber = ep.number, - AirDate = DateTime.Parse(ep.airdate), + AirDate = FormatDate(ep.airdate), Title = ep.name, Url = ep.url }); @@ -196,5 +196,10 @@ namespace Ombi.Core.Helpers return this; } + + private DateTime FormatDate(string date) + { + return string.IsNullOrEmpty(date) ? DateTime.MinValue : DateTime.Parse(date); + } } } \ No newline at end of file