diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-16 22:58:27 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-16 22:58:27 -0500 |
| commit | 26978a1f9fd2124b2bcee34dbcea74a11befc7f1 (patch) | |
| tree | cb0a59e8a8a0f9b38844890393ca5a8fc9f7607c | |
| parent | ca5afcb0d2f8acb16d3261a2d334e3cc4cb8e809 (diff) | |
add ArgumentNullExceptions
3 files changed, 20 insertions, 0 deletions
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<List<MediaSourceInfo>> 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<List<MediaSourceInfo>> 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<LiveStream> 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); } |
