diff --git a/OpenRA.Mods.Cnc/Traits/World/TSEditorResourceLayer.cs b/OpenRA.Mods.Cnc/Traits/World/TSEditorResourceLayer.cs index 496b3a6a28f0..92757890bcbc 100644 --- a/OpenRA.Mods.Cnc/Traits/World/TSEditorResourceLayer.cs +++ b/OpenRA.Mods.Cnc/Traits/World/TSEditorResourceLayer.cs @@ -99,6 +99,9 @@ protected override int AddResource(string resourceType, CPos cell, int amount = var resourceIsVeins = resourceType == info.VeinType; foreach (var c in Common.Util.ExpandFootprint(cell, false)) { + if (!Map.Resources.Contains(c)) + continue; + var resourceIndex = Map.Resources[c].Type; if (resourceIndex == 0 || !ResourceTypesByIndex.TryGetValue(resourceIndex, out var neighourResourceType)) neighourResourceType = null;