From 507ce40ad2cb3304fd5940a762ef8d2eedf3c004 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Tue, 2 Jun 2020 12:04:29 +0200 Subject: [PATCH] Fix a crash in LegacyBridgeLayer --- OpenRA.Mods.Common/Traits/World/LegacyBridgeLayer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/World/LegacyBridgeLayer.cs b/OpenRA.Mods.Common/Traits/World/LegacyBridgeLayer.cs index 890fad8f47..2e6ef3700c 100644 --- a/OpenRA.Mods.Common/Traits/World/LegacyBridgeLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/LegacyBridgeLayer.cs @@ -89,9 +89,12 @@ namespace OpenRA.Mods.Common.Traits // Where do we expect to find the subtile var subtile = new CPos(ni + ind % template.Size.X, nj + ind / template.Size.X); + if (!mapTiles.Contains(subtile)) + continue; + // This isn't the bridge you're looking for var subti = mapTiles[subtile]; - if (!mapTiles.Contains(subtile) || subti.Type != tile || subti.Index != ind) + if (subti.Type != tile || subti.Index != ind) continue; subTiles.Add(subtile, ind);