From 5185cfb0dbfe6952979fb7896eb70a679298e40f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 5 Dec 2015 20:40:49 -0500 Subject: [PATCH] fix null checks --- MediaBrowser.Api/Library/LibraryHelpers.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs index 2e0afa4116..7e30ffc931 100644 --- a/MediaBrowser.Api/Library/LibraryHelpers.cs +++ b/MediaBrowser.Api/Library/LibraryHelpers.cs @@ -31,10 +31,15 @@ namespace MediaBrowser.Api.Library /// The media folder does not exist 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 /// The app paths. public static void AddMediaPath(IFileSystem fileSystem, string virtualFolderName, string path, IServerApplicationPaths appPaths) { - if (!string.IsNullOrWhiteSpace(path)) + if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentNullException("path"); }