diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-08-23 12:49:42 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-08-23 12:49:42 -0400 |
| commit | f694ae7e95d7b6e682831ea26e5b2aa5b08fae55 (patch) | |
| tree | 26b7f92a410ee454363afe8f35987c794f2c0817 | |
| parent | 636943be4b1674a14d09bef22471fd977bc56e11 (diff) | |
add null checks to ScheduleDirect
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index e12acf140..6fe3615d3 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -247,7 +247,10 @@ namespace Emby.Server.Implementations.LiveTv.Listings ProgramAudio audioType = ProgramAudio.Stereo; bool repeat = programInfo.@new == null; - string newID = programInfo.programID + "T" + startAt.Ticks + "C" + channelId; + + var programId = programInfo.programID ?? string.Empty; + + string newID = programId + "T" + startAt.Ticks + "C" + channelId; if (programInfo.audioProperties != null) { @@ -300,7 +303,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings Etag = programInfo.md5 }; - var showId = programInfo.programID ?? string.Empty; + var showId = programId; if (!info.IsSeries) { @@ -339,11 +342,11 @@ namespace Emby.Server.Implementations.LiveTv.Listings if (details.descriptions != null) { - if (details.descriptions.description1000 != null) + if (details.descriptions.description1000 != null && details.descriptions.description1000.Count > 0) { info.Overview = details.descriptions.description1000[0].description; } - else if (details.descriptions.description100 != null) + else if (details.descriptions.description100 != null && details.descriptions.description100.Count > 0) { info.Overview = details.descriptions.description100[0].description; } @@ -351,16 +354,19 @@ namespace Emby.Server.Implementations.LiveTv.Listings if (info.IsSeries) { - info.SeriesId = programInfo.programID.Substring(0, 10); + info.SeriesId = programId.Substring(0, 10); if (details.metadata != null) { var gracenote = details.metadata.Find(x => x.Gracenote != null).Gracenote; - info.SeasonNumber = gracenote.season; - - if (gracenote.episode > 0) + if (gracenote != null) { - info.EpisodeNumber = gracenote.episode; + info.SeasonNumber = gracenote.season; + + if (gracenote.episode > 0) + { + info.EpisodeNumber = gracenote.episode; + } } } } |
