Skip to content

Commit e0a8e15

Browse files
authored
Merge pull request #1006 from rwf-rr/bugfix-content-form-2089801
Bugfix: Content Form exception when there is manually installed content in a top level directory.
2 parents 23578e9 + 9c13d51 commit e0a8e15

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Source/Menu/ContentForm.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,9 @@ string determineBrowseDir()
15361536
Dictionary<string, int> subDirs = new Dictionary<string, int>();
15371537
foreach (var folder in Settings.Folders.Folders)
15381538
{
1539-
string subDir = Directory.GetParent(folder.Value).ToString();
1539+
var parentDir = Directory.GetParent(folder.Value);
1540+
if (parentDir == null) { continue; } // ignore content in top-level dir
1541+
string subDir = parentDir.ToString();
15401542
if (subDirs.ContainsKey(subDir))
15411543
{
15421544
subDirs[subDir] += 1;
@@ -1556,16 +1558,16 @@ string determineBrowseDir()
15561558
}
15571559
}
15581560

1559-
string brouwseDir = "";
1561+
string browseDir = "";
15601562
foreach (var subDir in subDirs)
15611563
{
15621564
if (subDir.Value == max)
15631565
{
1564-
brouwseDir = subDir.Key;
1566+
browseDir = subDir.Key;
15651567
}
15661568
}
15671569

1568-
return brouwseDir;
1570+
return browseDir;
15691571
}
15701572

15711573
#endregion

0 commit comments

Comments
 (0)