fix overeager asset propagation for bundles

This commit is contained in:
Jesse Plamondon-Willard 2019-12-15 00:04:00 -05:00
parent 4aa2c0c3ec
commit 18a5b07c5b
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
1 changed files with 6 additions and 4 deletions

View File

@ -239,11 +239,13 @@ namespace StardewModdingAPI.Metadata
int rewardsCount = pair.Value.Split('/')[2].Split(' ').Length;
// add bundles
if (bundles.TryGetValue(bundleKey, out bool[] values))
if (!bundles.TryGetValue(bundleKey, out bool[] values) || values.Length < rewardsCount)
{
values ??= new bool[0];
bundles.Remove(bundleKey);
else
values = new bool[0];
bundles[bundleKey] = values.Concat(Enumerable.Repeat(false, rewardsCount - values.Length)).ToArray();
bundles[bundleKey] = values.Concat(Enumerable.Repeat(false, rewardsCount - values.Length)).ToArray();
}
// add bundle rewards
if (!rewards.ContainsKey(bundleKey))