Merge pull request #901 from atravita-mods/develop

Avoid resolving empty folders
This commit is contained in:
Jesse Plamondon-Willard 2023-04-02 15:39:46 -04:00
commit d13046edb6
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 5 additions and 2 deletions

View File

@ -180,7 +180,10 @@ namespace StardewModdingAPI.Framework.ModLoading
return mods
.OrderBy(mod =>
{
string id = mod.Manifest.UniqueID;
string? id = mod.Manifest?.UniqueID;
if (id is null)
return 0;
if (modIdsToLoadEarly.TryGetValue(id, out string? actualId))
return -int.MaxValue + Array.IndexOf(earlyArray, actualId);

View File

@ -433,7 +433,7 @@ namespace StardewModdingAPI.Framework
// apply load order customizations
if (this.Settings.ModsToLoadEarly.Any() || this.Settings.ModsToLoadLate.Any())
{
HashSet<string> installedIds = new HashSet<string>(mods.Select(p => p.Manifest.UniqueID), StringComparer.OrdinalIgnoreCase);
HashSet<string> installedIds = new HashSet<string>(mods.Where(p => p.FailReason is null).Select(p => p.Manifest.UniqueID), StringComparer.OrdinalIgnoreCase);
string[] missingEarlyMods = this.Settings.ModsToLoadEarly.Where(id => !installedIds.Contains(id)).OrderBy(p => p, StringComparer.OrdinalIgnoreCase).ToArray();
string[] missingLateMods = this.Settings.ModsToLoadLate.Where(id => !installedIds.Contains(id)).OrderBy(p => p, StringComparer.OrdinalIgnoreCase).ToArray();