fix error if a mod has a 'Dependencies' entry with no ID

This commit is contained in:
Jesse Plamondon-Willard 2021-05-09 12:19:30 -04:00
parent 7c76c5cad2
commit 4ac04ee3ac
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
1 changed files with 7 additions and 4 deletions

View File

@ -195,7 +195,7 @@ namespace StardewModdingAPI.Framework.ModLoading
/// <inheritdoc />
public IEnumerable<UpdateKey> 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<string, bool>(StringComparer.OrdinalIgnoreCase);
if (this.Manifest != null)
if (this.HasManifest())
{
// yield dependencies
foreach (IManifestDependency entry in this.Manifest.Dependencies)
{
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;
}