From 58ccaf9a1e3a9e374f07f23b5c3043dd3c0566ba Mon Sep 17 00:00:00 2001 From: atravita-mods <94934860+atravita-mods@users.noreply.github.com> Date: Thu, 23 Mar 2023 22:04:21 -0400 Subject: avoid resolving empty folders. --- src/SMAPI/Framework/ModLoading/ModResolver.cs | 1 + src/SMAPI/Framework/SCore.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index cb62e16f..40d8b3bc 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -178,6 +178,7 @@ namespace StardewModdingAPI.Framework.ModLoading string[] lateArray = modIdsToLoadLate.ToArray(); return mods + .Where(mod => mod.FailReason is not null) .OrderBy(mod => { string id = mod.Manifest.UniqueID; diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index 1d146d5f..37ca1556 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -433,7 +433,7 @@ namespace StardewModdingAPI.Framework // apply load order customizations if (this.Settings.ModsToLoadEarly.Any() || this.Settings.ModsToLoadLate.Any()) { - HashSet installedIds = new HashSet(mods.Select(p => p.Manifest.UniqueID), StringComparer.OrdinalIgnoreCase); + HashSet installedIds = new HashSet(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(); -- cgit From c12e9d788e71aaee155a4a055c08ccb88f0e8c21 Mon Sep 17 00:00:00 2001 From: atravita-mods <94934860+atravita-mods@users.noreply.github.com> Date: Thu, 23 Mar 2023 22:24:07 -0400 Subject: as per comments, remove where in favor of nullchecking id instead --- src/SMAPI/Framework/ModLoading/ModResolver.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index 40d8b3bc..37aceb1b 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -178,10 +178,12 @@ namespace StardewModdingAPI.Framework.ModLoading string[] lateArray = modIdsToLoadLate.ToArray(); return mods - .Where(mod => mod.FailReason is not null) .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); -- cgit