Fix IndexOutOfRangeException

Fixes situations where the filename is something like "-------".
This commit is contained in:
softworkz 2016-08-05 02:36:04 +02:00
parent 97446d04df
commit 6cf28f1c4e

View File

@ -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) ?