diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-05-09 12:12:03 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-05-09 12:12:03 -0400 |
commit | 4b391d631ccde301969ae0c04f407a01ba4055b1 (patch) | |
tree | 2c5d9317dd3b64731739aaeb64235cde00c8a948 /src/SMAPI/Framework/ModLoading/ModMetadata.cs | |
parent | d9c001a39f4562038fb608468169ea22cf074111 (diff) | |
download | SMAPI-4b391d631ccde301969ae0c04f407a01ba4055b1.tar.gz SMAPI-4b391d631ccde301969ae0c04f407a01ba4055b1.tar.bz2 SMAPI-4b391d631ccde301969ae0c04f407a01ba4055b1.zip |
normalize manifest array fields
Diffstat (limited to 'src/SMAPI/Framework/ModLoading/ModMetadata.cs')
-rw-r--r-- | src/SMAPI/Framework/ModLoading/ModMetadata.cs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs index 17e6d59a..b703f74c 100644 --- a/src/SMAPI/Framework/ModLoading/ModMetadata.cs +++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs @@ -195,7 +195,10 @@ namespace StardewModdingAPI.Framework.ModLoading /// <inheritdoc /> public IEnumerable<UpdateKey> GetUpdateKeys(bool validOnly = false) { - foreach (string rawKey in this.Manifest?.UpdateKeys ?? new string[0]) + if (this.Manifest == null) + yield break; + + foreach (string rawKey in this.Manifest.UpdateKeys) { UpdateKey updateKey = UpdateKey.Parse(rawKey); if (updateKey.LooksValid || !validOnly) @@ -251,16 +254,16 @@ namespace StardewModdingAPI.Framework.ModLoading { var ids = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase); - // yield dependencies - if (this.Manifest?.Dependencies != null) + if (this.Manifest != null) { - foreach (var entry in this.Manifest?.Dependencies) + // yield dependencies + foreach (IManifestDependency entry in this.Manifest.Dependencies) ids[entry.UniqueID] = entry.IsRequired; - } - // yield content pack parent - if (this.Manifest?.ContentPackFor?.UniqueID != null) - ids[this.Manifest.ContentPackFor.UniqueID] = true; + // yield content pack parent + if (this.Manifest.ContentPackFor?.UniqueID != null) + ids[this.Manifest.ContentPackFor.UniqueID] = true; + } return ids; } |