diff options
| author | softworkz <softworkz@hotmail.com> | 2016-08-05 02:36:04 +0200 |
|---|---|---|
| committer | softworkz <softworkz@hotmail.com> | 2016-08-05 04:59:27 +0200 |
| commit | 6cf28f1c4e191b8599aedc1f71c01de77d7ff7cb (patch) | |
| tree | b0721359c09ca996ed6d08973c3282da59d5b9cb /MediaBrowser.Server.Implementations/Library/LibraryManager.cs | |
| parent | 97446d04df47262bb65cba60868f76a03b3d4edc (diff) | |
Fix IndexOutOfRangeException
Fixes situations where the filename is something like "-------".
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/LibraryManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/LibraryManager.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 015fc3778..7af495f5a 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -923,14 +923,14 @@ namespace MediaBrowser.Server.Implementations.Library if (type == typeof(Person)) { - var subFolderIndex = 0; - - while (!char.IsLetterOrDigit(validFilename[subFolderIndex])) + foreach (char c in validFilename) { - subFolderIndex++; + if (char.IsLetterOrDigit(c)) + { + subFolderPrefix = c.ToString(); + break; + } } - - subFolderPrefix = validFilename.Substring(subFolderIndex, 1); } var fullPath = string.IsNullOrEmpty(subFolderPrefix) ? |
