add ArgumentNullExceptions

pull/702/head
Luke Pulverenti 8 years ago
parent ca5afcb0d2
commit 26978a1f9f

@ -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

@ -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();

@ -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);
} }

Loading…
Cancel
Save