summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r--src/SMAPI/Framework/Content/AssetDataForMap.cs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/SMAPI/Framework/Content/AssetDataForMap.cs b/src/SMAPI/Framework/Content/AssetDataForMap.cs
index 8674461e..b8722ead 100644
--- a/src/SMAPI/Framework/Content/AssetDataForMap.cs
+++ b/src/SMAPI/Framework/Content/AssetDataForMap.cs
@@ -99,8 +99,15 @@ namespace StardewModdingAPI.Framework.Content
}
// get target layers
- IDictionary<Layer, Layer> sourceToTargetLayers = source.Layers.ToDictionary(p => p, p => target.GetLayer(p.Id));
- HashSet<Layer> orphanedTargetLayers = new HashSet<Layer>(target.Layers.Except(sourceToTargetLayers.Values));
+ Dictionary<Layer, Layer> sourceToTargetLayers =
+ (
+ from sourceLayer in source.Layers
+ let targetLayer = target.GetLayer(sourceLayer.Id)
+ where targetLayer != null
+ select (sourceLayer, targetLayer)
+ )
+ .ToDictionary(p => p.sourceLayer, p => p.targetLayer);
+ HashSet<Layer> orphanedTargetLayers = new(target.Layers.Except(sourceToTargetLayers.Values));
// apply tiles
bool replaceAll = patchMode == PatchMapMode.Replace;