2
0
Эх сурвалжийг харах

add ArgumentNullExceptions

Luke Pulverenti 8 жил өмнө
parent
commit
26978a1f9f

+ 5 - 0
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

+ 10 - 0
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();

+ 5 - 0
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);
         }