فهرست منبع

Merge pull request #1299 from MediaBrowser/master

fix null checks
Luke 9 سال پیش
والد
کامیت
cff2678bdf
1فایلهای تغییر یافته به همراه7 افزوده شده و 2 حذف شده
  1. 7 2
      MediaBrowser.Api/Library/LibraryHelpers.cs

+ 7 - 2
MediaBrowser.Api/Library/LibraryHelpers.cs

@@ -31,10 +31,15 @@ namespace MediaBrowser.Api.Library
         /// <exception cref="System.IO.DirectoryNotFoundException">The media folder does not exist</exception>
         public static void RemoveMediaPath(IFileSystem fileSystem, string virtualFolderName, string mediaPath, IServerApplicationPaths appPaths)
         {
+            if (string.IsNullOrWhiteSpace(mediaPath))
+            {
+                throw new ArgumentNullException("mediaPath");
+            }
+
             var rootFolderPath = appPaths.DefaultUserViewsPath;
             var path = Path.Combine(rootFolderPath, virtualFolderName);
 
-			if (!fileSystem.DirectoryExists(path))
+            if (!fileSystem.DirectoryExists(path))
             {
                 throw new DirectoryNotFoundException(string.Format("The media collection {0} does not exist", virtualFolderName));
             }
@@ -56,7 +61,7 @@ namespace MediaBrowser.Api.Library
         /// <param name="appPaths">The app paths.</param>
         public static void AddMediaPath(IFileSystem fileSystem, string virtualFolderName, string path, IServerApplicationPaths appPaths)
         {
-            if (!string.IsNullOrWhiteSpace(path))
+            if (string.IsNullOrWhiteSpace(path))
             {
                 throw new ArgumentNullException("path");
             }