diff options
| author | Luke <luke.pulverenti@gmail.com> | 2015-12-05 20:45:06 -0500 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2015-12-05 20:45:06 -0500 |
| commit | cff2678bdf260f138cd550da19f5f94a3135f1b9 (patch) | |
| tree | 669e79071512ef35db92a4f7e83bec8a11296b6e | |
| parent | 9a7b4e516e4319f1c250c1f159dfa0cf26446e9b (diff) | |
| parent | 5185cfb0dbfe6952979fb7896eb70a679298e40f (diff) | |
Merge pull request #1299 from MediaBrowser/master
fix null checks
| -rw-r--r-- | MediaBrowser.Api/Library/LibraryHelpers.cs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs index 2e0afa411..7e30ffc93 100644 --- a/MediaBrowser.Api/Library/LibraryHelpers.cs +++ b/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"); } |
