Fix crash in TSEditorResourceLayer when adding resources.
Ensure cells are within map bounds when checking if adjacent cells should be cleared during resource placement.
This commit is contained in:
@@ -99,6 +99,9 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
var resourceIsVeins = resourceType == info.VeinType;
|
var resourceIsVeins = resourceType == info.VeinType;
|
||||||
foreach (var c in Common.Util.ExpandFootprint(cell, false))
|
foreach (var c in Common.Util.ExpandFootprint(cell, false))
|
||||||
{
|
{
|
||||||
|
if (!Map.Resources.Contains(c))
|
||||||
|
continue;
|
||||||
|
|
||||||
var resourceIndex = Map.Resources[c].Type;
|
var resourceIndex = Map.Resources[c].Type;
|
||||||
if (resourceIndex == 0 || !ResourceTypesByIndex.TryGetValue(resourceIndex, out var neighourResourceType))
|
if (resourceIndex == 0 || !ResourceTypesByIndex.TryGetValue(resourceIndex, out var neighourResourceType))
|
||||||
neighourResourceType = null;
|
neighourResourceType = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user