From 1d5017f1197862d0d9c9f7aa4e13216cad3746d6 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 24 Aug 2022 17:49:12 -0400 Subject: [PATCH] fix broken mods with no ID listed as duplicate --- docs/release-notes.md | 3 +++ src/SMAPI/Framework/ModLoading/ModResolver.cs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index ca7d6e6e..68dc7874 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -7,6 +7,9 @@ _If needed, you can update to SMAPI 3.16.0 first and then install the latest version._ --> +## Upcoming release +* Fixed broken mods sometimes incorrectly listed as duplicate. + ## 3.16.0 Released 22 August 2022 for Stardew Valley 1.5.6 or later. See [release highlights](https://www.patreon.com/posts/70797008). diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index c5648c74..5f1fbe4b 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -218,12 +218,12 @@ namespace StardewModdingAPI.Framework.ModLoading { var duplicatesByID = mods .GroupBy(mod => mod.Manifest?.UniqueID?.Trim(), mod => mod, StringComparer.OrdinalIgnoreCase) - .Where(p => p.Count() > 1); + .Where(p => !string.IsNullOrEmpty(p.Key) && p.Count() > 1); foreach (var group in duplicatesByID) { foreach (IModMetadata mod in group) { - if (mod.Status == ModMetadataStatus.Failed && mod.FailReason != ModFailReason.InvalidManifest) + if (mod.Status == ModMetadataStatus.Failed && mod.FailReason is not (ModFailReason.InvalidManifest or ModFailReason.LoadFailed or ModFailReason.MissingDependencies)) continue; string folderList = string.Join(", ", group.Select(p => p.GetRelativePathWithRoot()).OrderBy(p => p));