add ArgumentNullExceptions

This commit is contained in:
Luke Pulverenti 2016-11-16 22:58:27 -05:00
parent ca5afcb0d2
commit 26978a1f9f
3 changed files with 20 additions and 0 deletions

View File

@ -992,6 +992,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
public async Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken) public async Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken)
{ {
if (string.IsNullOrWhiteSpace(channelId))
{
throw new ArgumentNullException("channelId");
}
foreach (var hostInstance in _liveTvManager.TunerHosts) foreach (var hostInstance in _liveTvManager.TunerHosts)
{ {
try try

View File

@ -101,6 +101,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
public async Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken) public async Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken)
{ {
if (string.IsNullOrWhiteSpace(channelId))
{
throw new ArgumentNullException("channelId");
}
if (IsValidChannelId(channelId)) if (IsValidChannelId(channelId))
{ {
var hosts = GetTunerHosts(); var hosts = GetTunerHosts();
@ -161,6 +166,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
public async Task<LiveStream> GetChannelStream(string channelId, string streamId, CancellationToken cancellationToken) public async Task<LiveStream> GetChannelStream(string channelId, string streamId, CancellationToken cancellationToken)
{ {
if (string.IsNullOrWhiteSpace(channelId))
{
throw new ArgumentNullException("channelId");
}
if (!IsValidChannelId(channelId)) if (!IsValidChannelId(channelId))
{ {
throw new FileNotFoundException(); throw new FileNotFoundException();

View File

@ -87,6 +87,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
protected override bool IsValidChannelId(string channelId) protected override bool IsValidChannelId(string channelId)
{ {
if (string.IsNullOrWhiteSpace(channelId))
{
throw new ArgumentNullException("channelId");
}
return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase); return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase);
} }