From b4670345dd08f71bd226daf7941e16fb0565c64f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Tue, 3 Nov 2020 14:08:37 +0100 Subject: [PATCH] Don't crash when the bullet bounces outside of the map. --- OpenRA.Mods.Common/Projectiles/Bullet.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Projectiles/Bullet.cs b/OpenRA.Mods.Common/Projectiles/Bullet.cs index a6dcc79a7d..4482e3083a 100644 --- a/OpenRA.Mods.Common/Projectiles/Bullet.cs +++ b/OpenRA.Mods.Common/Projectiles/Bullet.cs @@ -235,8 +235,11 @@ namespace OpenRA.Mods.Common.Projectiles if (flightLengthReached && shouldBounce) { - var terrainPos = world.Map.CellContaining(pos); - if (info.InvalidBounceTerrain.Contains(world.Map.GetTerrainInfo(terrainPos).Type)) + var cell = world.Map.CellContaining(pos); + if (!world.Map.Contains(cell)) + return true; + + if (info.InvalidBounceTerrain.Contains(world.Map.GetTerrainInfo(cell).Type)) return true; if (AnyValidTargetsInRadius(world, pos, info.Width, args.SourceActor, true))