From 26978a1f9fd2124b2bcee34dbcea74a11befc7f1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 16 Nov 2016 22:58:27 -0500 Subject: [PATCH] add ArgumentNullExceptions --- Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs | 5 +++++ .../LiveTv/TunerHosts/BaseTunerHost.cs | 10 ++++++++++ .../LiveTv/TunerHosts/M3UTunerHost.cs | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index aaf74b5c6..81a6b8508 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -992,6 +992,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV public async Task> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken) { + if (string.IsNullOrWhiteSpace(channelId)) + { + throw new ArgumentNullException("channelId"); + } + foreach (var hostInstance in _liveTvManager.TunerHosts) { try diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs index ad43a611b..5fae3f666 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs @@ -101,6 +101,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts public async Task> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken) { + if (string.IsNullOrWhiteSpace(channelId)) + { + throw new ArgumentNullException("channelId"); + } + if (IsValidChannelId(channelId)) { var hosts = GetTunerHosts(); @@ -161,6 +166,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts public async Task GetChannelStream(string channelId, string streamId, CancellationToken cancellationToken) { + if (string.IsNullOrWhiteSpace(channelId)) + { + throw new ArgumentNullException("channelId"); + } + if (!IsValidChannelId(channelId)) { throw new FileNotFoundException(); diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs index 756c3377c..19454abbc 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs @@ -87,6 +87,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts protected override bool IsValidChannelId(string channelId) { + if (string.IsNullOrWhiteSpace(channelId)) + { + throw new ArgumentNullException("channelId"); + } + return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase); }