aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsoftworkz <softworkz@hotmail.com>2016-08-05 02:36:04 +0200
committersoftworkz <softworkz@hotmail.com>2016-08-05 04:59:27 +0200
commit6cf28f1c4e191b8599aedc1f71c01de77d7ff7cb (patch)
treeb0721359c09ca996ed6d08973c3282da59d5b9cb
parent97446d04df47262bb65cba60868f76a03b3d4edc (diff)
Fix IndexOutOfRangeException
Fixes situations where the filename is something like "-------".
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs12
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) ?