From 4ac04ee3aca00f7c1e105ddabd1ed16995b17086 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 9 May 2021 12:19:30 -0400 Subject: [PATCH] fix error if a mod has a 'Dependencies' entry with no ID --- src/SMAPI/Framework/ModLoading/ModMetadata.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs index b703f74c..0ace084f 100644 --- a/src/SMAPI/Framework/ModLoading/ModMetadata.cs +++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs @@ -195,7 +195,7 @@ namespace StardewModdingAPI.Framework.ModLoading /// public IEnumerable GetUpdateKeys(bool validOnly = false) { - if (this.Manifest == null) + if (!this.HasManifest()) yield break; foreach (string rawKey in this.Manifest.UpdateKeys) @@ -254,14 +254,17 @@ namespace StardewModdingAPI.Framework.ModLoading { var ids = new Dictionary(StringComparer.OrdinalIgnoreCase); - if (this.Manifest != null) + if (this.HasManifest()) { // yield dependencies foreach (IManifestDependency entry in this.Manifest.Dependencies) - ids[entry.UniqueID] = entry.IsRequired; + { + if (!string.IsNullOrWhiteSpace(entry.UniqueID)) + ids[entry.UniqueID] = entry.IsRequired; + } // yield content pack parent - if (this.Manifest.ContentPackFor?.UniqueID != null) + if (!string.IsNullOrWhiteSpace(this.Manifest.ContentPackFor?.UniqueID)) ids[this.Manifest.ContentPackFor.UniqueID] = true; }