From 4cc021adfe3aab9c4b464035e2c2edf7771c70ff Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 26 Jul 2010 22:16:23 +1200 Subject: [PATCH] fix dumb crash in minimap -- actors outside the map accessed memory that wasnt part of the bitmap. --- OpenRA.Game/Graphics/Minimap.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/Graphics/Minimap.cs b/OpenRA.Game/Graphics/Minimap.cs index 00807213a0..59dda3321a 100644 --- a/OpenRA.Game/Graphics/Minimap.cs +++ b/OpenRA.Game/Graphics/Minimap.cs @@ -123,8 +123,9 @@ namespace OpenRA.Graphics foreach (var t in world.Queries.WithTraitMultiple()) { var color = t.Trait.RadarSignatureColor(t.Actor); - foreach( var cell in t.Trait.RadarSignatureCells(t.Actor)) - *(c + ((cell.Y - world.Map.TopLeft.Y)* bitmapData.Stride >> 2) + cell.X - world.Map.TopLeft.X) = color.ToArgb(); + foreach (var cell in t.Trait.RadarSignatureCells(t.Actor)) + if (world.Map.IsInMap(cell)) + *(c + ((cell.Y - world.Map.TopLeft.Y) * bitmapData.Stride >> 2) + cell.X - world.Map.TopLeft.X) = color.ToArgb(); } }