diff --git a/BDInfo/BDROM.cs b/BDInfo/BDROM.cs index 97dbfbf3bd..2faeb405e2 100644 --- a/BDInfo/BDROM.cs +++ b/BDInfo/BDROM.cs @@ -77,6 +77,11 @@ namespace BDInfo public BDROM( string path, IFileSystem fileSystem, ITextEncoding textEncoding) { + if (string.IsNullOrWhiteSpace(path)) + { + throw new ArgumentNullException("path"); + } + _fileSystem = fileSystem; // // Locate BDMV directories. @@ -326,15 +331,28 @@ namespace BDInfo private FileSystemMetadata GetDirectoryBDMV( string path) { + if (string.IsNullOrWhiteSpace(path)) + { + throw new ArgumentNullException("path"); + } + FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path); while (dir != null) { - if (dir.Name == "BDMV") + if (string.Equals(dir.Name, "BDMV", StringComparison.OrdinalIgnoreCase)) { return dir; } - dir = _fileSystem.GetDirectoryInfo(Path.GetDirectoryName(dir.FullName)); + var parentFolder = Path.GetDirectoryName(dir.FullName); + if (string.IsNullOrEmpty(parentFolder)) + { + dir = null; + } + else + { + dir = _fileSystem.GetDirectoryInfo(parentFolder); + } } return GetDirectory("BDMV", _fileSystem.GetDirectoryInfo(path), 0); @@ -350,7 +368,7 @@ namespace BDInfo FileSystemMetadata[] children = _fileSystem.GetDirectories(dir.FullName).ToArray(); foreach (FileSystemMetadata child in children) { - if (child.Name == name) + if (string.Equals(child.Name, name, StringComparison.OrdinalIgnoreCase)) { return child; } diff --git a/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs b/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs index bf7343f3d2..219b1f3c5d 100644 --- a/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs +++ b/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs @@ -30,6 +30,11 @@ namespace MediaBrowser.MediaEncoding.BdInfo /// BlurayDiscInfo. public BlurayDiscInfo GetDiscInfo(string path) { + if (string.IsNullOrWhiteSpace(path)) + { + throw new ArgumentNullException("path"); + } + var bdrom = new BDROM(path, _fileSystem, _textEncoding); bdrom.Scan(); diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index 0a070d3487..c1bae4b3cb 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -328,6 +328,11 @@ namespace MediaBrowser.Providers.MediaInfo /// VideoStream. private BlurayDiscInfo GetBDInfo(string path) { + if (string.IsNullOrWhiteSpace(path)) + { + throw new ArgumentNullException("path"); + } + try { return _blurayExaminer.GetDiscInfo(path);